Skip to content
AgenticAIWiki

Validate, retry with the error, pass

Full screen
JSONMessy email"invoice of 3rd April, 410 total"JSON schemainvoice_date: YYYY-MM-DDModelextracts fieldsValidatorschema + business rulesjson

Swipe to change step

Step 1 of 7. A messy email and a JSON schema go to the model. The schema is the contract: field names, types, and the date format YYYY-MM-DD. Messy email ("invoice of 3rd April, 410 total"). JSON schema (invoice_date: YYYY-MM-DD), highlighted. Model (extracts fields). Validator (schema + business rules). arrow from Messy email to Model. arrow from JSON schema to Model. arrow from Model to Validator, labelled JSON. a email moving along e1.

In this chapter

  1. 14.1JSON schemas for output5 min read
  2. 14.2Constrained decoding and strict schema modes6 min read
  3. 14.3Nullable fields so the model doesn't invent values4 min read
  4. 14.4Validation-retry loops5 min read
  5. 14.5Batch extraction at scale5 min read
  6. 14.6Forcing structure with tool_use5 min read
  7. 14.7Mapping typed models to response schemas6 min read
  8. 14.8Refusals, truncation and validation retries5 min read

Chapter check

Already know this? Score 80% or more and you can skip ahead. Each attempt draws 4 questions from 12.

Loading check…