Expand description
Re-exports§
pub use anthropic::AnthropicBedrockConfig;anthropicandbedrockpub use anthropic::AnthropicClientConfig;anthropicpub use anthropic::AnthropicModel;anthropicpub use anthropic::AnthropicModelConfig;anthropicpub use anthropic::AnthropicModelOptions;anthropicpub use bedrock::BedrockModel;bedrockpub use bedrock::BedrockModelConfig;bedrockpub use bedrock::BedrockModelOptions;bedrockpub use openai::BedrockMantleConfig;mantlepub use openai::OpenAIApi;openaipub use openai::OpenAIClientConfig;openaipub use openai::OpenAIModel;openaipub use openai::OpenAIModelConfig;openaipub use openai::OpenAIModelOptions;openai
Modules§
- anthropic
anthropic - The Anthropic Messages API provider, behind the
anthropicfeature. - bedrock
bedrock - The Amazon Bedrock model provider, behind the
bedrockfeature (on by default). - openai
openai - The OpenAI provider, behind the
openaifeature. - routing
- Strategy-based model routing.
- streaming
- Model stream events, token usage and metrics.
Structs§
- Base
Model Config - Configuration every model provider supports (
BaseModelConfig). - Cache
Config - Prompt caching configuration (
CacheConfig). Providers consume only the fields they support. - Count
Tokens Options - Options for
Model::count_tokens(CountTokensOptions). - Model
Capabilities - What the model can do (
ModelCapabilities).Noneis unknown. - Model
Info - Everything the SDK knows about a model (
ModelInfo). Read it fromModel::model_info. - Model
Limits - Size limits of the model (
ModelLimits).Noneis unknown. - Model
Request - One request to a model: the conversation and its options.
- Redaction
- Redaction of the user’s input when a guardrail blocked it (
Redaction). - Stream
Aggregated Result - The final value of
Model::stream_aggregated(StreamAggregatedResult). - Summarize
Options - Options for
Model::summarize(SummarizeOptions). - Summarize
Result - The result of
Model::summarize(SummarizeResult).
Enums§
- Aggregated
Event - An item of
Model::stream_aggregated: a raw event, a completed block, or the final result. - Cache
Key - The prompt-cache routing key for providers that route by key.
- Cache
Section Setting - Whether a cache section is cached, and for how long.
- Cache
Strategy - Whether caching skips models that are not known to support it (
CacheConfig.strategy). - Deferred
Tool Loading - How a model keeps deferred tool schemas out of its context until it loads them
(
DeferredToolLoading). - Prompt
Caching - How a model supports prompt caching (
PromptCaching).
Traits§
- Model
- A model provider (
Model).
Functions§
- base_
model_ info - The default
Model::model_infofor a configuration, before any provider facts: the shared model info for the model id,temporary_messagesoff,deferred_tool_loadingasStubsunless the shared info saysUnsupported, thecontext_window_limitand themodel_infooverride. A provider that overridesModel::model_infostarts from it (seeModelInfo::merge). - estimate_
tokens - The default
Model::count_tokensestimate: text length / 4 and JSON length / 2, in UTF-16 code units, with only the latest user message’s injected blocks. - summarize_
client_ side - The default
Model::summarize: sendsmessagesas a request that ends with one summarize instruction and returns the reply’s text as aSummaryBlock.
Type Aliases§
- BoxStream
- A pinned, boxed,
Sendstream, as returned byModel::stream. - Cache
Ttl - TTL of a cache entry (
CacheTTL), such as"5m"or"1h". Providers validate it server-side.