Please read the PydanticAI docs for more information on how to use PydanticAI.
Create an Agent with PydanticAI
PydanticAI is a Python agent framework designed to make it AI Agent creation less painful to build for production grade applications with Generative AI.Why would you use PydanticAI with PremAI?
If you work in an industry that needs fine-tuned agents for your use case, PydanticAI is a great tool to use as a complement to PremAI. Pydantic makes it easy to create AI agents that can utilize tools without all the complexity of other agent frameworks. Combined with Prem you can create very powerful and flexible agents that can be used in a production environment and are trained on your own data.Prerequisites
pydantic-ai
library- Prem API Key
- python 3.9+ (We have been primarily using uv to install packages!)
1
Install the Pydantic AI library
python
2
Import the Pydantic AI library
Make sure you have the following imports for the OpenAI provider and the OpenAI model.python
3
Connect to the Prem AI API
python
4
Create the Agent and run it
python
Full Example
python