MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / BaseToolMethod

Class BaseToolMethod

toolbench/tooleval/evaluation/methodcls.py:3–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1from typing import Dict, List,Callable
2
3class BaseToolMethod:
4 def __init__(self):
5 pass
6 def convert_result_to_dict(self,result):
7 '''Return Format
8 --------
9 {
10 'method': 'method name',
11 'total_steps': int,
12 'final_answer': 'answer',
13 'answer_details': [{
14 "role": "system",
15 "message": "",
16 "next": [
17 {
18 "role": "user",
19 "message": "I am planning ...",
20 "next": [
21 {
22 "role": "tool",
23 "message": "{'name': 'Finish', 'arguments': '{\\n \"return_type\": \"give_answer\",\\n \"final_answer\": \"I encountere...",
24 "next": []
25 }
26 ]
27 }
28 ]
29 }]
30 }
31
32 '''
33 pass
34 def forward(self,query:str,tools:List[Dict],tool_func:Callable)->Dict:
35 pass
36
37 def __call__(self,query:str,tools:List[Dict],tool_func:Callable)->Dict:
38 result = self.forward(query,tools,tool_func)
39 return self.convert_result_to_dict(result)
40

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected