Module 05 Activity
Scenario
The next step after the model call is code, so the answer needs a shape.
What you build
A parser plus a validating schema, a feedback-driven retry with a ceiling, and a schema-change plan.
Steps
- Replace prose output with a requested shape and route on a field rather than grepping text.
- Run four candidate responses through the parser, including truncated JSON and prose-wrapped JSON.
- Add a schema constraining types, allowed values and at least one format.
- Build a retry that feeds the specific error back, caps attempts and has a give-up path.
- Count parse failures separately from validation failures and alert on each.
- Write the schema-change plan, including the deploy order for a widened enum.
Evidence to hand in
- Field-based routing replacing prose parsing.
- Four candidates with their parse outcomes.
- The schema with values and formats.
- The retry with feedback, ceiling and give-up.
- The two failure counters.
- The schema-change plan.
Review checklist
- Routing reads a field, not prose.
- The schema rejects a plausible label outside the allowed set.
- The retry feeds back the specific error, not 'try again'.
- Parse and validation failures are counted separately.
- The deploy plan says readers before writers for a widened enum.
