Setup
Install thepydantic-ai library:
Model Configuration
UseOpenAIChatModel paired with OpenAIProvider configured with the Neosantara gateway base URL and your API key.
Structured Outputs with Pydantic Models
Enforce strict output formats by passing a PydanticBaseModel to the result_type parameter:
Agents with Tool Calling
Attach tools to your agent with the@agent.tool decorator: