Skip to main content

Module traits

Module traits 

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.
ModelListingUnsupportedError
Typed marker returned when a provider intentionally has no live model-list endpoint. Callers may use a separate canonical static catalog only for this condition; transport, authentication, and malformed-response failures must remain actionable.
ModelPricing
ModelRefusalError
A provider safety refusal that completed at the transport layer but cannot be accepted as an assistant response.
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.
SemanticEmptyTerminalCompletion
A transport-successful provider result that cannot complete a request.
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.
ThinkingDisplay
Anthropic’s thinking.display request field (beta thinking-display-updates-2026-08-18), controlling whether thinking blocks come back omitted, as progress updates, or summarized.
ToolRoundPolicy
Requested tool-call cadence for one provider response.
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.
durable_chat_messages
Project a full agent conversation history down to the flat ChatMessage shape durable session backends store: user/assistant chat turns only, system prompt excluded (the backend restores against the caller’s own system prompt, not a persisted one). AssistantToolCalls and ToolResults are tool-loop plumbing that durable session transcripts have never persisted; only the visible chat turns are kept.
projected_entry_count
Count the conversation entries a transcript projects into, without materializing them. One entry per chat message; an assistant tool-call message contributes its non-empty text plus one entry per call; a tool result folds into the entry of a call still awaiting a result (FIFO by tool_call_id) and otherwise counts as its own orphan entry.
strip_think_tags
Remove inline <think>...</think> reasoning before terminal-response classification or user-visible parsing.

Type Aliases§

StreamResult
Result type for streaming operations.