Skip to main content

Module model_provider

Module model_provider 

Structs§

ChatMessage
A single message in a conversation.
ChatRequest
Request payload for model_provider chat calls.
ChatResponse
An LLM response that may contain text, tool calls, or both.
ModelInfo
Model info with optional pricing — returned by list_models_with_pricing.
ModelPricing
NativeThinkingParams
Parameters for native extended thinking support.
ProviderCapabilities
ModelProvider capabilities declaration. Describes what features a model_provider supports, enabling intelligent adaptation of tool calling modes and request formatting.
ProviderCapabilityError
Structured error returned when a requested capability is not supported.
StreamChunk
A chunk of content from a streaming response.
StreamOptions
Options for streaming chat requests.
TokenUsage
ToolCall
A tool call requested by the LLM.
ToolResultMessage
A tool result to feed back to the LLM.

Enums§

ConversationMessage
A message in a multi-turn conversation, including tool interactions.
StreamError
Errors that can occur during streaming.
StreamEvent
Structured events emitted by model_provider streaming APIs. This extends plain text chunk streaming with explicit tool-call signals so agent loops can preserve native tool semantics without parsing payload text.
ToolsPayload
ModelProvider-specific tool payload formats.

Constants§

BASELINE_MAX_TOKENS
Output-token budget roomy enough for typical agent turns. Providers override per family where the model’s own context window is the binding constraint.
BASELINE_TEMPERATURE
Industry-neutral sampling temperature. OpenAI, Gemini, OpenRouter, and most OpenAI-compatible endpoints document 0.7 as their typical default; Anthropic and Ollama override (1.0 and 0.0 respectively).
BASELINE_TIMEOUT_SECS
HTTP timeout for cloud inference. Local model_providers (Ollama) override upward since CPU/GPU-bound inference runs slower than round-tripping to a hyperscaler.
BASELINE_WIRE_API
Wire protocol used when the model_provider doesn’t declare one. Only OpenAI’s Codex stack uses the “responses” protocol; everything else speaks the classic chat completions shape.
MAX_BUDGET_TOKENS
MIN_BUDGET_TOKENS
Anthropic’s documented minimum for extended-thinking budget_tokens. Requests below this are rejected with 400 by the provider; clamping at resolution time gives a clearer error site than the first API call.
PRUNED_CONTEXT_SEPARATOR
PRUNED_TOOL_EXCHANGE_SUMMARY_PREFIX
PRUNED_TOOL_EXCHANGE_SUMMARY_SUFFIX

Traits§

ModelProvider

Functions§

build_tool_instructions_text
Build tool instructions text for prompt-guided tool calling.

Type Aliases§

StreamResult
Result type for streaming operations.