PydanticAI is a Python agent framework designed to make it AI Agent creation less painful to build for production grade applications with Generative AI.
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.
agent = Agent( premai_agent, deps_type=str, system_prompt="You are a helpful assistant that can answer questions about the world.")#you can also run this without asyncio.run_sync by using agent.run("Who is Stephen Curry?") check pydantic docs/reference for more info.async def main(): response = await agent.run("Who is Stephen Curry?") print(response.output) # This will print the agent's response# Run the async functionasyncio.run(main())
from pydantic_ai import Agent, RunContextfrom pydantic_ai.models.openai import OpenAIModelfrom pydantic_ai.providers.openai import OpenAIProviderimport osimport asynciopremai_agent = OpenAIModel( 'claude-3.7-sonnet',#'gpt-4o-mini',gpt-4-o,claude-3.5-sonnet,claude-3.7-sonnet etc... provider=OpenAIProvider( base_url='https://studio.premai.io/api/v1', api_key=os.getenv('PREMAI_API_KEY'), ))agent = Agent( premai_agent, deps_type=str, system_prompt="You are a helpful assistant that can answer questions about the world.")#you can also run this without asyncio.run_sync by using agent.run("Who is Stephen Curry?") check pydantic docs/reference for more info.async def main(): response = await agent.run("Who is Stephen Curry?") print(response.output) # This will print the agent's response# Run the async functionasyncio.run(main())