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

Function get_steps

toolbench/tooleval/utils.py:21–42  ·  view source on GitHub ↗
(example)

Source from the content-addressed store, hash-verified

19test_sets = ["G1_instruction", "G1_category", "G1_tool", "G2_instruction", "G2_category", "G3_instruction"]
20
21def get_steps(example):
22 answer_details = example["answer"]["answer_details"][0]
23 answer_steps = []
24 step_cnt = 1
25 final_step = ""
26
27 while "next" in answer_details:
28 answer_str = answer_details["message"]
29 role_str = answer_details["role"]
30
31 if answer_str and role_str == "tool":
32 step_text = f"Step {step_cnt}: {answer_str}"
33 answer_steps.append(step_text)
34 final_step = f"Final step: {answer_str}"
35 step_cnt += 1
36
37 if not answer_details["next"]:
38 break
39
40 answer_details = answer_details["next"][0]
41
42 return "\n".join(answer_steps), final_step
43
44
45def generate_init_message_node(eg:ExecutionGraph,functions,query):

Callers 3

compute_pass_rateFunction · 0.90
eval_pass_rate.pyFile · 0.90
write_resultsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected