Lab 09 — Evaluate the pipeline

Scaffold: 1/5. You stop building features and start measuring one. The assistant and the harness are here; you design the judge.

The scenario

Every earlier lab left you with a working feature and a nagging question: is it any good, and would a change make it better or worse? You cannot answer that by eyeballing one reply. You need a golden set, an automatic judge, and a score, so a change becomes a number you can compare. This lab builds that loop over a tiny grounded assistant.

The requirement

Run the eval and get back a score and a per-question verdict: the four answerable questions should pass, and the out-of-scope one should pass only if the assistant declined to answer it.

What’s provided

Your task

Implement judge(question, reference, answer), returning {"pass": bool, "reason": str}:

  1. Prompt a model to compare the assistant’s answer to the reference and decide pass or fail (for the out-of-scope item, pass only if the assistant declined).
  2. Ask for JSON only, at temperature 0.
  3. Parse it; fail closed with a reason when it will not parse, and when it parses into something that is not an object.

This is LLM-as-a-judge. The rubric you write in that prompt is the whole game.

Run it

# Prerequisite: Model access enabled for your model, in your region. The default
# model id, amazon.nova-lite-v1:0, is on-demand in us-east-1; elsewhere use the
# inference profile: MODEL_ID=us.amazon.nova-lite-v1:0 ./scripts/deploy.sh
./scripts/deploy.sh
./scripts/test.sh
./scripts/teardown.sh

What success looks like

test.sh prints something like "score": 1.0, "passed": 5, "total": 5 with a reason for each verdict. Break the assistant (lower its grounding, or point it at a wrong model) and the score drops, which is the entire point: the number moved, so you can tell.

If it fails

Reveal the solution

SRC=solution ./scripts/deploy.sh && ./scripts/test.sh

What you just learned

Next

Lab 10 — The capstone. No gap to fill and no scaffolding: just data, a requirement, and the pieces you have built across the track. You assemble a grounded, guarded, evaluated assistant from scratch.