Structured Outputs
Get machine-readable output from models by designing JSON Schemas, using provider-enforced structured output, and validating or repairing what comes back.
3 objectives 6 steps about 100 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Design a JSON Schema or Pydantic model for an extraction or decision task, including enums, optional fields and an explicit 'cannot answer' path.
- Request schema-constrained output from a provider and explain what constrained decoding does and does not guarantee.
- Validate model output in code and handle refusals, truncation and validation failures with a bounded repair or retry.
Lesson plan
6 steps, about 100 min · 5 of 5 lessons available so far
- Why Free Text Breaks Pipelines Concept · 10 min
- Designing a Schema for an Extraction Task Worked example · 20 min
- Constrained Decoding and Its Limits Concept · 15 min
- Lab: Enforced Schemas Across Two Providers Lab · 25 min
- Validation, Repair and Retry Budgets Worked example · 20 min
- Check: Schema and Failure Scenarios Knowledge check · 6 questions
Practise it
Extract invoice fields (vendor, date, line items, total, currency) from 30 sample documents into a Pydantic model using a provider's structured-output mode; report field-level accuracy and count the refusals, truncations and validation failures your repair step handled.
References
Hard prerequisites
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.