Skip to course content
Free generative AI app course

Generative AI Application Development with Python

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

  1. Replace prose output with a requested shape and route on a field rather than grepping text.
  2. Run four candidate responses through the parser, including truncated JSON and prose-wrapped JSON.
  3. Add a schema constraining types, allowed values and at least one format.
  4. Build a retry that feeds the specific error back, caps attempts and has a give-up path.
  5. Count parse failures separately from validation failures and alert on each.
  6. Write the schema-change plan, including the deploy order for a widened enum.

Evidence to hand in

Review checklist