agentix.providers.litellm¶
litellm ¶
LiteLLM bridge — one adapter, 100+ providers.
LiteLLM <https://docs.litellm.ai/>_ exposes a single OpenAI-shaped
acompletion that fans out to OpenAI, Azure, Anthropic, Bedrock, Vertex,
Mistral, Groq, Ollama and many more behind provider-prefixed model ids
("gpt-4o", "anthropic/claude-opus-4-8", "gemini/gemini-2.0-flash",
"ollama/llama3", …). Install with pip install "agentix[litellm]".
This is the pragmatic "works with whatever the user already has" option; the
dedicated adapters (OpenAIModel, GeminiModel, BedrockModel,
OllamaModel) exist for when you want first-party control and typed knobs.
LiteLLMModel ¶
A :class:~agentix.model.ModelFn backed by litellm.acompletion.
model uses LiteLLM's provider-prefixed ids. extra is forwarded to
acompletion (e.g. api_base, api_key, temperature,
num_retries). For tests, inject client= — any object exposing an
async acompletion(**kwargs) (the litellm module itself by default).
with_response_format ¶
Return a copy that requests JSON-schema output (for response_model).