AI Engineer Portal
Your personal operating system for career transition.
Exercise
Build an eval result storage and comparison layer
Build an Eval Result Storage and Comparison Layer
Eval results are only useful if you can compare them across runs. This exercise builds the persistence and comparison layer that makes prompt iteration data-driven.
What to build
Implement EvalStore:
-
save(run_id: str, report: dict) -> None— Persists the report underrun_id. RaisesValueErrorif run_id already exists. -
load(run_id: str) -> dict— Returns the stored report. RaisesKeyErrorif not found. -
list_runs() -> list[str]— Returns all run_ids in insertion order. -
compare(run_id_a: str, run_id_b: str) -> dict— Returns{"run_a", "run_b", "pass_rate_delta", "avg_score_delta", "regression_count_delta", "improved": bool}.improved = Trueifavg_score_delta > 0andregression_count_delta <= 0. -
best_run(metric: str = "avg_score") -> str | None— Returns the run_id with the highest value for the given metric key. ReturnsNoneif empty.
Constraints
- Standard library only. In-memory store is fine (no file I/O required).
Evaluation / medium / Step 30 of 36
Evaluation and review loops
Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.
- - Produces a useful signal, not decorative output
- - Makes regression review easier
- - Would support a benchmark or observability loop
- - Would this output help decide what to fix next?
- - Are important failure modes visible?
- - Does the score hide any ambiguity I should record?
Practice
Generate a variation
Generate a new exercise variation to deepen understanding or practice a related concept.
Attempt history
Recent submissions
Before you submit, decide what a strong answer should make obvious to the reviewer.
No attempts yet.