PydanticAI Examples¶
A comprehensive collection of examples demonstrating PydanticAI framework capabilities — from basic model requests to advanced document processing with schema validation.
-
Direct Model Requests
Make LLM calls without agents using the direct API.
-
Temperature
Control output randomness and creativity with temperature.
-
Reasoning Effort
Tune internal reasoning depth for speed vs accuracy.
-
Basic Sentiment
Fixed 3-class sentiment analysis with structured outputs.
-
Dynamic Classification
Runtime-adaptable classification with dynamic Literal types.
-
Bielik (Local Models)
Run a Polish LLM locally with Ollama and PydanticAI.
-
History Processor
Manage conversation history, filtering, and persistence.
-
OCR Parsing
Extract structured data from PDFs with schema validation.
Why PydanticAI?¶
PydanticAI brings type safety and structured outputs to LLM interactions. Instead of parsing free-form text, you define Pydantic models and let the framework handle validation, retries, and schema enforcement.
These examples show real patterns you can adapt for your own projects — each one is self-contained and runnable.
Getting Started¶
New here? Head to the Getting Started guide for setup instructions, then follow the learning path through the examples.