Pydantic
5 pieces on Pydantic, including 3 step-by-step guides.
Guides
Generate Structured Dating Profiles with Outlines and Pydantic
Use Outlines to constrain an LLM to emit valid JSON dating profiles with Pydantic enums, nested objects, and list length limits, based on the repository example.

Guaranteed JSON from llama.cpp with Pydantic and GBNF grammars
Use llama.cpp's GBNF grammar constraints and Pydantic validation together to make invalid JSON structurally impossible at inference time.
Building AI Agents in Python with Pydantic AI
Learn how to build production-ready AI agents in Python using Pydantic AI, with structured outputs, custom tools, and dependency injection.
News & Analysis
Valid JSON, Wrong Data: Where Structured Outputs Stop Working
Structured Outputs guarantee schema shape, not truth. Here's the three-layer fix for silent data corruption in LLM extraction pipelines.

Structured Output with Local LLMs: When Valid JSON Is Not Enough
Gemma 4's 4B model returns schema-valid JSON that still includes the wrong device. Here's the decomposition pattern that fixes it.