#[non_exhaustive]pub struct ChatModelConfig { /* private fields */ }Expand description
Builder-side configuration that flows into every ModelRequest
the ChatModel issues. Stored separately from the leaf service
so layers / streaming / future surfaces share one source of
truth.
Fields are private. Construct via ChatModelConfig::new;
mutate through ChatModel’s with_* setters; inspect through
the bare accessors on this type. #[non_exhaustive] plus the
privatised fields together mean post-1.0 additions ship as MINOR
without surprising any downstream consumer.
Implementations§
Source§impl ChatModelConfig
impl ChatModelConfig
Sourcepub fn new(model: impl Into<String>) -> Self
pub fn new(model: impl Into<String>) -> Self
Build a fresh config seeded with model and otherwise
defaulted.
Sourcepub fn token_counter(&self) -> Option<&Arc<dyn TokenCounter>>
pub fn token_counter(&self) -> Option<&Arc<dyn TokenCounter>>
Borrow the configured token counter, if any. Returns None
when the operator has not wired one — pre-flight budget
enforcement falls back to vendor Usage post-response.
Sourcepub const fn validation_retries(&self) -> u32
pub const fn validation_retries(&self) -> u32
complete_typed<O> retry budget. Default 0 — the first
schema-mismatch fail surfaces unchanged. Operators that want
the loop to reflect the parse error to the model and ask for
a corrected JSON response set this to 1–3.
Sourcepub const fn max_tokens(&self) -> Option<u32>
pub const fn max_tokens(&self) -> Option<u32>
Per-call max_tokens cap (None = vendor default).
Sourcepub const fn system(&self) -> &SystemPrompt
pub const fn system(&self) -> &SystemPrompt
System-prompt blocks prepended to every call. Supports per-block prompt caching (Anthropic / Bedrock Converse).
Sourcepub const fn temperature(&self) -> Option<f32>
pub const fn temperature(&self) -> Option<f32>
Sampling temperature.
Sourcepub const fn top_k(&self) -> Option<u32>
pub const fn top_k(&self) -> Option<u32>
Top-k sampling parameter (None ⇒ vendor default). Codec
support follows the IR mapping documented on
crate::ir::ModelRequest::top_k.
Sourcepub fn stop_sequences(&self) -> &[String]
pub fn stop_sequences(&self) -> &[String]
Stop sequences.
Sourcepub const fn tool_choice(&self) -> &ToolChoice
pub const fn tool_choice(&self) -> &ToolChoice
Tool-choice mode.
Sourcepub const fn reasoning_effort(&self) -> Option<&ReasoningEffort>
pub const fn reasoning_effort(&self) -> Option<&ReasoningEffort>
Cross-vendor reasoning-effort knob (None ⇒ vendor default).
Codecs translate onto their native wire shape per the
per-vendor mapping documented on
crate::ir::ReasoningEffort; lossy approximations emit
ModelWarning::LossyEncode.
Sourcepub fn build_request(&self, messages: Vec<Message>) -> ModelRequest
pub fn build_request(&self, messages: Vec<Message>) -> ModelRequest
Combine config with caller-supplied messages into a full
ModelRequest. Only the fields the config carries are
projected; per-request knobs and provider extensions stay at
their Default (i.e. unset) and flow in via RequestOverrides
or direct ExecutionContext::add_extension instead.
Trait Implementations§
Source§impl Clone for ChatModelConfig
impl Clone for ChatModelConfig
Source§fn clone(&self) -> ChatModelConfig
fn clone(&self) -> ChatModelConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more