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

Class base_search_method

toolbench/inference/Algorithms/base_search.py:3–32  ·  view source on GitHub ↗

For the base tree search method, you need to support the following functions

Source from the content-addressed store, hash-verified

1from Downstream_tasks.base_env import base_env
2
3class base_search_method:
4 """For the base tree search method, you need to support the following functions"""
5
6 def __init__(self,llm,io_func: base_env, process_id=0, callbacks = None):
7 """Args:
8 llm: The interface of the LLM
9 io_func(base_env): Interface to the environment,
10 process_id (int, optional): In multiprocessing annotation, this describes the process id. Defaults to 0.
11 callbacks (_type_, optional): _description_. Defaults to None.
12 """
13 pass
14
15 def to_json(self,answer=False,process=True):
16 '''
17 return a json object,
18 If "answer" = True. must have the following field to make answer annotation
19 If "process" = True. You need provide the full information of the tree searching process
20
21 "answer_generation": {
22 "valid_data": bool,
23 "final_answer": string,
24 "finish_type": enum["give_up","give_answer"]
25 "train_messages": [ [openAI-message] ],
26 }
27 '''
28 raise NotImplementedError
29
30 def start(self, **args):
31 """This is the entry point of the searching process"""
32 raise NotImplementedError
33

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected