MCPcopy
hub / github.com/SqueezeAILab/LLMCompiler / generate_tools

Function generate_tools

configs/parallelqa/tools.py:81–107  ·  view source on GitHub ↗
(args, model_name)

Source from the content-addressed store, hash-verified

79
80
81def 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 ]

Callers

nothing calls this directly

Calls 4

get_modelFunction · 0.90
ToolClass · 0.90
from_llmMethod · 0.80

Tested by

no test coverage detected