π§±Understand Structured Output and Function Calling
Stop bolting regex onto markdown-wrapped near-JSON. Compare prompt-asks, JSON mode, and schema-constrained decoding head-to-head, then write a strict schema for one of your real LLM outputs and test it for compliance.
Phase 1Why Text Outputs Break and What Structure Fixes
See why text outputs break and what structure fixes
A 'JSON' string is not a contract
6 minA 'JSON' string is not a contract
The five ways prompt-only JSON breaks
6 minThe five ways prompt-only JSON breaks
Structure isn't a format β it's a constraint at decode time
6 minStructure isn't a format β it's a constraint at decode time
A schema is the API contract you wish you'd written first
7 minA schema is the API contract you wish you'd written first
Phase 2Three Ways to Get the Same JSON
Get the same answer three ways and compare failures
Pure prompting is the baseline you measure against
7 minPure prompting is the baseline you measure against
JSON mode kills the parsing bugs and only the parsing bugs
6 minJSON mode kills the parsing bugs and only the parsing bugs
Schema-constrained decoding makes invalid output literally impossible
7 minSchema-constrained decoding makes invalid output literally impossible
Three layers, one shape, three different failure surfaces
7 minThree layers, one shape, three different failure surfaces
When the parser stops failing, the prompt starts failing differently
7 minWhen the parser stops failing, the prompt starts failing differently
Phase 3Constrained Decoding and Function Calling
Connect constrained decoding and function calling end to end
A scenario: the decoder mid-token, deciding what's allowed next
7 minA scenario: the decoder mid-token, deciding what's allowed next
A scenario: which tool, which args, which schema
7 minA scenario: which tool, which args, which schema
A scenario: the over-strict schema that ships less reliable code
7 minA scenario: the over-strict schema that ships less reliable code
A scenario: the eval that catches what the schema can't
7 minA scenario: the eval that catches what the schema can't
Phase 4Write a Strict Schema for Your Real Output
Write a strict schema for your real output and test it
Define a strict schema for one real LLM output and test it
8 minDefine a strict schema for one real LLM output and test it
Frequently asked questions
- What is structured output in LLMs?
- This is covered in the βUnderstand Structured Output and Function Callingβ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- How is JSON mode different from schema-constrained decoding?
- This is covered in the βUnderstand Structured Output and Function Callingβ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- Why does asking for JSON in a prompt still return markdown-wrapped JSON?
- This is covered in the βUnderstand Structured Output and Function Callingβ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- What is function calling and how does it relate to structured output?
- This is covered in the βUnderstand Structured Output and Function Callingβ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- How do I test an LLM output against a JSON Schema?
- This is covered in the βUnderstand Structured Output and Function Callingβ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Related paths
πPython Decorators Introduction
Build one mental model for Python decorators that covers closures, argument passing, functools.wraps, and stacking β then ship a working caching or logging decorator from scratch in under 30 lines.
π¦Rust Lifetimes Explained
Stop reading `'a` as line noise and start reading it as scope arithmetic β one failing snippet at a time β until you can thread lifetimes through a small parser or iterator adapter without fighting the borrow checker.
βΈοΈKubernetes Core Concepts
Stop drowning in 30+ resource types. Build the mental model one primitive at a time -- pods, deployments, services, ingress, config -- then deploy a real app with rolling updates and health checks.
πBig O Intuition
Stop treating Big O as math you memorized for an interview β build the intuition to spot O(nΒ²) disasters, pick the right data structure without thinking, and rewrite a slow function from O(nΒ²) to O(n) in under five minutes.