COURSE 08L0100% FREE
Verified 2026-08-10

Structured outputs

Getting models to return **JSON/schemas** (or other strict formats) so software can parse results safely.

What it is

Getting models to return JSON/schemas (or other strict formats) so software can parse results safely.

Why it matters

Agents and workflows break on free-form prose. Structure enables tools and validation.

How it works (plain)

Provide a schema → use constrained decoding / JSON mode when available → validate → retry or repair on failure.

Try it

Ask for a recipe as JSON with fields title, minutes, steps[]; validate it in code.

Myths

⚠️ Myth: “Return JSON” in English is enough.
✓ Reality: Constraints + validation beat polite requests alone.

Sources

  • Course 08 prompting-patterns; Course 10 tool-use
  • Provider structured output docs (cite specifically)