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

Method evaluate

AgentBench.old/src/task.py:84–100  ·  view source on GitHub ↗
(self, agent: Agent, already_runs: List[Any]=None)

Source from the content-addressed store, hash-verified

82 pass
83
84 def evaluate(self, agent: Agent, already_runs: List[Any]=None) -> Dict[str, Any]:
85 print(f"Evaluating task '{self.name}' ...")
86 data = self.get_data()
87 inputs = data.get_inputs()
88 targets = data.get_targets()
89 try:
90 results = self.predict_all(agent, inputs, already_runs)
91 except:
92 results = self.predict_all(agent, inputs)
93 # print(results)
94 # print(type(results))
95 result_dict = {}
96 for metric in self.metrics:
97 result_dict[metric] = self.metrics[metric](results, targets)
98 print(f"Task '{self.name}' evaluation finished. The results are saved in '{self.get_output_dir()}'")
99 self.save_runs_all(inputs, results, targets, result_dict)
100 return result_dict
101
102 def predict_all(self, agent: Agent, inputs: List[T_INPUT], already_runs: List[Any]=None) -> List[T_OUTPUT]:
103 print(f"Start Predicting All ...")

Callers 11

evaluate_all_tasksFunction · 0.45
mainFunction · 0.45
llm_accuracy_scoreFunction · 0.45
main.jsFile · 0.45
main.jsFile · 0.45
main.jsFile · 0.45
fetch_browser_infoMethod · 0.45
execute_scrollFunction · 0.45
aexecute_scrollFunction · 0.45
__call__Method · 0.45

Calls 6

get_dataMethod · 0.95
predict_allMethod · 0.95
get_output_dirMethod · 0.95
save_runs_allMethod · 0.95
get_inputsMethod · 0.80
get_targetsMethod · 0.80

Tested by

no test coverage detected