(args, model_name)
| 79 | |
| 80 | |
| 81 | def generate_tools(args, model_name): |
| 82 | llm_math_chain = get_model( |
| 83 | model_type=args.model_type, |
| 84 | api_key=args.api_key, |
| 85 | vllm_port=args.vllm_port, |
| 86 | stream=False, |
| 87 | temperature=0, |
| 88 | ) |
| 89 | llm_math_chain = LLMMathChain.from_llm(llm=llm_math_chain, verbose=True) |
| 90 | return [ |
| 91 | Tool( |
| 92 | name="search", |
| 93 | func=docstore.asearch, |
| 94 | description=( |
| 95 | "search(entity: str) -> str:\n" |
| 96 | " - Executes an exact search for the entity on Wikipedia.\n" |
| 97 | " - Returns the first paragraph if the entity is found.\n" |
| 98 | ), |
| 99 | stringify_rule=lambda args: f"search({args[0]})", |
| 100 | ), |
| 101 | Tool( |
| 102 | name="math", |
| 103 | func=run_llm_math_chain_factory(llm_math_chain), |
| 104 | description=_MATH_DESCRIPTION, |
| 105 | stringify_rule=lambda args: f"math({args[0]})", # drop context |
| 106 | ), |
| 107 | ] |
nothing calls this directly
no test coverage detected