方寸 Portal

AI Engineer Portal

Your personal operating system for career transition.

Private mode

Exercise

Create a golden dataset test suite

Create a Golden Dataset Test Suite

A golden dataset is a curated set of test cases you trust to detect regressions. Build the infrastructure to load, run, and report on a golden evaluation suite.

What you are building

Implement a GoldenSuite class that:

  1. Loads cases from JSONL -- each line has case_id, input, expected, and category fields.
  2. Runs evaluation -- for each case, calls a generate_fn and a score_fn, records score and pass/fail.
  3. Detects regressions -- accepts a baseline report dict and identifies any case where current score is more than 0.10 below the baseline score for the same case_id.
  4. Reports by category -- returns average score and pass rate broken down by category.
  5. Outputs a portable report -- returns a dict with by_case scores suitable as the next run's baseline.

Constraints

  • Use only the Python standard library.
  • score_fn signature: (response: str, expected: str) -> float returning 0.0 to 1.0.
  • generate_fn signature: (input: str) -> str.
  • Pass threshold is configurable (default 0.7).
  • Regression threshold is configurable (default 0.10).

Evaluation / medium / Step 9 of 36

Practice stage

Evaluation and review loops

Hint

Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.

Success criteria
  • - Produces a useful signal, not decorative output
  • - Makes regression review easier
  • - Would support a benchmark or observability loop
Review checklist
  • - 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.