Example Pydantic AI Multi Modal
Example project demonstrating how to use multimodal LLMs as a tool for PydanticAI applications
Install / Use
npx skills add stephenc222/example-pydantic-ai-multi-modalInstalls into whichever agent you are using.
README
Pydantic AI Example: Invoice Processing Agent
This project demonstrates how to build an AI-powered invoice processing agent using Pydantic AI, showcasing type-safe AI interactions with structured inputs and outputs.
Overview
This example implements an invoice processing system that:
- Extracts total amounts from invoice images
- Uses OpenAI's multimodal LLM capabilities
- Provides structured, type-safe outputs
- Includes comprehensive test coverage
Key Features
- Type-safe AI interactions using Pydantic models
- Structured dependency injection with dataclasses
- Async support for API operations
- OpenAI GPT-4 Vision integration
- Tool-augmented AI agent capabilities
Code Structure
The main components include:
MultimodalLLMService: Service for interacting with OpenAI's vision modelsInvoiceProcessingDependencies: Dependency container for the AI agentInvoiceExtractionResult: Structured output model for extracted data- Custom tools for processing invoice images
Prerequisites
Before running this project, ensure you have the following prerequisites:
- Python 3.8 or higher
- An OpenAI API key
- Required Python packages (listed in
requirements.txt)
To install the required packages, run:
pip install -r requirements.txt
Running the Project
To run the project, use the following command:
python3 app.py
Testing
To run the tests, use the following command:
pytest
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.6kCommit, push, and open a PR
