MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / save_result

Function save_result

src/benchmarks/elaipbench/instance.py:148–168  ·  view source on GitHub ↗

Save an ELAIPBench result as JSON.

(result: ELAIPBenchResult, output_dir: Path)

Source from the content-addressed store, hash-verified

146
147
148def save_result(result: ELAIPBenchResult, output_dir: Path) -> None:
149 """Save an ELAIPBench result as JSON."""
150 output_dir.mkdir(parents=True, exist_ok=True)
151 output_file = output_dir / f"{result.question_id}.json"
152
153 data = {
154 "question_id": result.question_id,
155 "question": result.question,
156 "question_type": result.question_type,
157 "correct_answer": result.correct_answer,
158 "paper_id": result.paper_id,
159 "status": result.status,
160 "response": result.response,
161 "parsed_answer": result.parsed_answer,
162 "is_correct": result.is_correct,
163 }
164 if result.error:
165 data["error"] = result.error
166
167 with open(output_file, "w", encoding="utf-8") as f:
168 json.dump(data, f, indent=2, ensure_ascii=False)

Callers 1

run_instanceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected