Examples Overview¶
Work through these examples in order to progressively learn PydanticAI — each one builds on concepts from the previous.
Learning Path¶
-
Understand basic LLM API calls without agents.
Beginner
-
2. Temperature
Control model output randomness and creativity.
Beginner
-
Tune reasoning depth for speed vs accuracy trade-offs.
Beginner
-
Learn structured outputs with Pydantic models and Literal types.
Intermediate
-
Generate classification schemas at runtime with
create_model().Intermediate
-
Run local models with Ollama, use tools and multi-turn conversations.
Intermediate
-
Manage conversation history, filtering, persistence, and context windows.
Advanced
-
8. OCR Parsing
Extract structured data from PDFs with schema validation and async processing.
Advanced