pub struct AnthropicModelConfig {
pub model_id: Option<String>,
pub max_tokens: Option<u64>,
pub temperature: Option<f64>,
pub top_p: Option<f64>,
pub context_window_limit: Option<u64>,
pub model_info: Option<ModelInfo>,
pub stop_sequences: Option<Vec<String>>,
pub params: Option<JsonValue>,
pub anthropic_tools: Option<Vec<JsonValue>>,
pub betas: Option<Vec<String>>,
pub use_native_token_count: Option<bool>,
pub cache_config: Option<CacheConfig>,
}Expand description
Configuration of an AnthropicModel (AnthropicModelConfig): the BaseModelConfig fields
and the Anthropic ones.
Fields§
§model_id: Option<String>The model id, such as claude-sonnet-4-6. Defaults to claude-sonnet-4-6, which can change
between versions.
max_tokens: Option<u64>Maximum tokens the model may generate. Defaults to the model’s output ceiling from the shared model info, else 64000; both can change between versions.
temperature: Option<f64>Controls randomness in generation. API version 2026-10-21 rejects it.
top_p: Option<f64>Nucleus sampling. API version 2026-10-21 rejects it.
context_window_limit: Option<u64>Context window size in tokens; filled from the shared model info when unset.
model_info: Option<ModelInfo>Overrides for what the SDK knows about the model.
stop_sequences: Option<Vec<String>>Sequences that stop generation.
params: Option<JsonValue>Extra request fields, merged over the formatted request. Extended thinking goes here, for
example {"thinking": {"type": "enabled", "budget_tokens": 1024}} or
{"thinking": {"type": "adaptive"}}. Server tools under tools are appended like
anthropic_tools. Must be a JSON object, such as a json!({..})
literal.
anthropic_tools: Option<Vec<JsonValue>>Anthropic server-side tools, such as
{"type": "web_search_20260318", "name": "web_search"}, web_fetch and code_execution,
appended after the agent’s function tools. Function tools (with an input_schema) are
rejected; use the agent’s tools for those. Each entry must be a JSON object.
betas: Option<Vec<String>>Beta features to enable through the anthropic-beta header, such as
interleaved-thinking-2025-05-14. None by default.
use_native_token_count: Option<bool>Whether Model::count_tokens calls the token counting API instead of estimating. Default
false.
cache_config: Option<CacheConfig>Prompt caching. Setting it caches the tool definitions, the system prompt and the
conversation up to the last user message; caching is off when unset. strategy has no
effect: every active Claude model caches prompts.
Implementations§
Source§impl AnthropicModelConfig
impl AnthropicModelConfig
Sourcepub fn builder() -> AnthropicModelConfigBuilder
pub fn builder() -> AnthropicModelConfigBuilder
Create an instance of AnthropicModelConfig using the builder syntax
Source§impl AnthropicModelConfig
impl AnthropicModelConfig
Sourcepub fn merge(&mut self, update: Self)
pub fn merge(&mut self, update: Self)
Shallow-merges update into self: every field update sets replaces the current value.
Sourcepub fn to_base(&self) -> BaseModelConfig
pub fn to_base(&self) -> BaseModelConfig
The BaseModelConfig fields of this configuration.
Trait Implementations§
Source§impl Clone for AnthropicModelConfig
impl Clone for AnthropicModelConfig
Source§impl Debug for AnthropicModelConfig
impl Debug for AnthropicModelConfig
Source§impl Default for AnthropicModelConfig
impl Default for AnthropicModelConfig
Source§impl From<AnthropicModelConfig> for AnthropicModelOptions
impl From<AnthropicModelConfig> for AnthropicModelOptions
Source§fn from(config: AnthropicModelConfig) -> Self
fn from(config: AnthropicModelConfig) -> Self
Source§impl From<BaseModelConfig> for AnthropicModelConfig
impl From<BaseModelConfig> for AnthropicModelConfig
Source§fn from(config: BaseModelConfig) -> Self
fn from(config: BaseModelConfig) -> Self
Source§impl PartialEq for AnthropicModelConfig
impl PartialEq for AnthropicModelConfig
impl StructuralPartialEq for AnthropicModelConfig
Auto Trait Implementations§
impl Freeze for AnthropicModelConfig
impl RefUnwindSafe for AnthropicModelConfig
impl Send for AnthropicModelConfig
impl Sync for AnthropicModelConfig
impl Unpin for AnthropicModelConfig
impl UnsafeUnpin for AnthropicModelConfig
impl UnwindSafe for AnthropicModelConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more