Pydantic released their agent framework that simplify the development of agent tools.
As exemplified in the documentation of pydantic, that you can find and this link, the installation process of Pydantica is pretty easy.
pip install pydantic-ai
With the command is possible to install the dependencies to let the framework to work. Anyway if you are interested in a particular model you can install only the dependecies for the models you are interested for with the command
pip install "pydantic-ai-slim[model]"
The list of available models providers can be found here
As soon as you use the library of pydantic you can choose of using different models from the providers available. Specifically the complete list of models available in using Pydantic can be found here.
The framework is also supporting local models, more specifically examples for Ollama are developed and shared at this link.
Starting from the example made by Pydantic, I further worked with the CLI input to let the user guess a number and check if their guess is correct.
You can find the entire code in the dice_game.py
file.
To use the example create a .env
file in the same folder as dice_game.py
inserting your API key from openAI.
export OPENAI_API_KEY='insert_your_openai_key_here'
To continue with this experimentation, the next step will be implementing a web chat to use a more complex agent that will help the user to take decision or something similar.