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

Method start

toolbench/inference/Algorithms/single_chain.py:72–91  ·  view source on GitHub ↗
(self,single_chain_max_step,pass_at=1,answer=1)

Source from the content-addressed store, hash-verified

70 return json_obj
71
72 def start(self,single_chain_max_step,pass_at=1,answer=1):
73 self.forward_args = locals()
74 if "self" in self.forward_args.keys():
75 self.forward_args.pop("self")
76
77 for i in range(pass_at):
78 if self.process_id == 0:
79 print(f"[single_chain]try for the {i+1} time")
80 self.tree = my_tree()
81 self.tree.root.node_type = "Action Input"
82 self.tree.root.io_state = deepcopy(self.io_func)
83 out_node = self.do_chain(self.tree.root, single_chain_max_step)
84 self.terminal_node.append(out_node)
85 self.try_list.append(self.to_json_single())
86 if out_node.io_state.check_success() == 1:
87 self.status = 1
88 self.success_count += 1
89 if self.success_count >= answer:
90 return 1
91 return 0
92
93
94 def do_chain(self,now_node,single_chain_max_step):

Callers

nothing calls this directly

Calls 4

do_chainMethod · 0.95
to_json_singleMethod · 0.95
my_treeClass · 0.90
check_successMethod · 0.45

Tested by

no test coverage detected