MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / _parse_tool

Method _parse_tool

eval_heldout/rewoo/algos/react.py:153–160  ·  view source on GitHub ↗
(self, intermediate_steps)

Source from the content-addressed store, hash-verified

151 self.agent.agent.llm_chain.prompt.template = PREFIX + self._generate_tool_prompt() + "\n" + self.fewshot
152
153 def _parse_tool(self, intermediate_steps):
154 tool_usage = {"serpapi": 0, "llm-math_token": 0}
155 for step in intermediate_steps:
156 if step[0].tool == "Search":
157 tool_usage["serpapi"] += 1
158 if step[0].tool == "Calculator":
159 tool_usage["llm-math_token"] += len(step[0].tool_input + step[1]) // 4 # 4 chars per token
160 return tool_usage
161
162 def _get_worker(self, name):
163 if name in WORKER_REGISTRY:

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected