ChatModel protocol, so you can swap one for another without touching the rest of your code. A model built from any provider drops into the same chains, agents, and graphs.
The ChatModel protocol
Each provider class exposes an identical surface:
Because the surface is shared, providers are interchangeable. Write your chain, agent, or graph once, then point it at whichever model you want.
Available providers
Provider SDKs are optional extras. The infy core has no third-party runtime dependencies, so you install only the providers you use.
Installing a provider
Pick the extra that matches the provider you want.Provider notes
- OpenAI
- Anthropic
- Gemini
- Ollama
Install Supports chat, tool calling, and structured output.
infy[openai], then construct OpenAIChat with a model name.Streaming
The same model instance streams synchronously or asynchronously.Structured output
with_structured_output accepts either a JSON-schema dict (parsed by the Rust JsonParser, no validation) or a pydantic model (parsed and validated by pydantic-core). The return type follows what you pass in.
Where to go next
Tools and agents
Build tool-calling agents with
create_agent on any provider.Governance
Policy-check every tool call and write a tamper-evident audit.