Structured outputs: guaranteed JSON
The idea: Constrained decoding forces output to match a schema by only allowing valid next tokens — so the JSON always parses. But schema-valid still isn't semantically correct, so validate the values too.
What you'll be able to do: You can explain constrained decoding / structured outputs, and why valid shape still needs value validation.
The problem it solves: Your code needs clean JSON, but the model sometimes adds prose or breaks the schema.
Builds on: An LLM feature in production
← Designing trustworthy AI features · Next: Why GPUs beat CPUs →
All lessons