Skip to content

Examples Overview

Work through these examples in order to progressively learn PydanticAI — each one builds on concepts from the previous.

Learning Path

  • 1. Direct Model Requests


    Understand basic LLM API calls without agents.

    Beginner

  • 2. Temperature


    Control model output randomness and creativity.

    Beginner

  • 3. Reasoning Effort


    Tune reasoning depth for speed vs accuracy trade-offs.

    Beginner

  • 4. Basic Sentiment


    Learn structured outputs with Pydantic models and Literal types.

    Intermediate

  • 5. Dynamic Classification


    Generate classification schemas at runtime with create_model().

    Intermediate

  • 6. Bielik (Local Models)


    Run local models with Ollama, use tools and multi-turn conversations.

    Intermediate

  • 7. History Processor


    Manage conversation history, filtering, persistence, and context windows.

    Advanced

  • 8. OCR Parsing


    Extract structured data from PDFs with schema validation and async processing.

    Advanced