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

Method save_runs_all

AgentBench.old/src/task.py:153–166  ·  view source on GitHub ↗
(self, inputs: List[T_INPUT], outputs: List[T_OUTPUT], targets: List[T_TARGET], metrics: Dict[str, Any] = None)

Source from the content-addressed store, hash-verified

151 f.write(json.dumps(save_obj, ensure_ascii=False) + "\n")
152
153 def save_runs_all(self, inputs: List[T_INPUT], outputs: List[T_OUTPUT], targets: List[T_TARGET], metrics: Dict[str, Any] = None):
154 if not os.path.exists(self.get_output_dir()):
155 try: os.makedirs(self.get_output_dir())
156 except: pass
157 for idx, (input, output, target) in enumerate(zip(inputs, outputs, targets)):
158 save_obj = {
159 "index": idx,
160 "input": serialize(input),
161 "output": serialize(output),
162 "target": serialize(target)
163 }
164 with open(os.path.join(self.get_output_dir(), "runs.jsonl"), "a", encoding="utf-8") as f:
165 f.write(json.dumps(save_obj, ensure_ascii=False) + "\n")
166 self.save_metrics_all(metrics)
167
168 def save_metrics_all(self, metrics: Dict[str, Any]):
169 if not os.path.exists(self.get_output_dir()):

Callers 1

evaluateMethod · 0.95

Calls 5

get_output_dirMethod · 0.95
save_metrics_allMethod · 0.95
joinMethod · 0.80
serializeFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected