Save an AIME result as JSON.
(result: AIMEResult, output_dir: Path)
| 7 | |
| 8 | |
| 9 | def save_result(result: AIMEResult, output_dir: Path) -> None: |
| 10 | """Save an AIME result as JSON.""" |
| 11 | output_dir.mkdir(parents=True, exist_ok=True) |
| 12 | output_file = output_dir / f"{result.problem_id}.json" |
| 13 | |
| 14 | data = { |
| 15 | "problem_id": result.problem_id, |
| 16 | "problem": result.problem, |
| 17 | "correct_answer": result.correct_answer, |
| 18 | "dataset": result.dataset, |
| 19 | "status": result.status, |
| 20 | "response": result.response, |
| 21 | "parsed_answer": result.parsed_answer, |
| 22 | "is_correct": result.is_correct, |
| 23 | } |
| 24 | if result.error: |
| 25 | data["error"] = result.error |
| 26 | |
| 27 | with open(output_file, "w", encoding="utf-8") as f: |
| 28 | json.dump(data, f, indent=2, ensure_ascii=False) |
no outgoing calls
no test coverage detected