Save evaluation summary to output_dir/evals/evaluation_summary.json. Args: eval_summary: Evaluation summary dict. output_dir: Base output directory. Returns: Path to the saved file.
(
eval_summary: dict[str, Any],
output_dir: str | Path,
)
| 285 | |
| 286 | |
| 287 | def save_eval_summary( |
| 288 | eval_summary: dict[str, Any], |
| 289 | output_dir: str | Path, |
| 290 | ) -> Path: |
| 291 | """Save evaluation summary to output_dir/evals/evaluation_summary.json. |
| 292 | |
| 293 | Args: |
| 294 | eval_summary: Evaluation summary dict. |
| 295 | output_dir: Base output directory. |
| 296 | |
| 297 | Returns: |
| 298 | Path to the saved file. |
| 299 | """ |
| 300 | eval_dir = Path(output_dir) / "evals" |
| 301 | eval_dir.mkdir(parents=True, exist_ok=True) |
| 302 | eval_path = eval_dir / "evaluation_summary.json" |
| 303 | with eval_path.open("w") as f: |
| 304 | json.dump(eval_summary, f, indent=2, ensure_ascii=False) |
| 305 | return eval_path |
| 306 | |
| 307 | |
| 308 | def print_summary(eval_summary: dict[str, Any]) -> None: |