pub struct ChatOptions {Show 16 fields
pub temperature: Option<f64>,
pub max_tokens: Option<u32>,
pub top_p: Option<f64>,
pub stop_sequences: Vec<String>,
pub capture_usage: Option<bool>,
pub capture_content: Option<bool>,
pub capture_reasoning_content: Option<bool>,
pub capture_tool_calls: Option<bool>,
pub capture_raw_body: Option<bool>,
pub response_format: Option<ChatResponseFormat>,
pub normalize_reasoning_content: Option<bool>,
pub reasoning_effort: Option<ReasoningEffort>,
pub verbosity: Option<Verbosity>,
pub seed: Option<u64>,
pub service_tier: Option<ServiceTier>,
pub extra_headers: Option<Headers>,
}Expand description
Options considered by all Client::exec_* chat calls.
A default can be set on the Client during builder configuration.
Per-call options take precedence over client defaults.
Fields§
§temperature: Option<f64>Sampling temperature (if supported by the provider).
max_tokens: Option<u32>Maximum tokens to generate (if supported).
top_p: Option<f64>Nucleus sampling (top-p), if supported.
stop_sequences: Vec<String>Sequences that halt generation when encountered.
capture_usage: Option<bool>(streaming) Capture usage metadata; available in StreamEnd.captured_usage.
capture_content: Option<bool>(streaming) Concatenate content chunks; available in StreamEnd.captured_content.
capture_reasoning_content: Option<bool>(streaming) Concatenate reasoning chunks; available in StreamEnd.captured_reasoning_content.
capture_tool_calls: Option<bool>(streaming) Collect tool calls; available in StreamEnd.captured_tool_calls.
capture_raw_body: Option<bool>Capture the raw HTTP body (primarily for debugging/inspection).
response_format: Option<ChatResponseFormat>Desired response format (e.g., ChatResponseFormat::JsonMode for OpenAI-style JSON mode).
Note: Additional formats may be added in the future.
normalize_reasoning_content: Option<bool>Extract -style reasoning blocks into ChatResponse.reasoning_content when present.
reasoning_effort: Option<ReasoningEffort>Preferred reasoning effort, when supported by the provider.
verbosity: Option<Verbosity>Verbosity (for OpenAI gpt-5),
seed: Option<u64>Seed for repeatability, if supported.
service_tier: Option<ServiceTier>Service tier preference (OpenAI-specific, for flex processing).
extra_headers: Option<Headers>Additional HTTP headers to include with the request.
Implementations§
Source§impl ChatOptions
Chainable Setters
impl ChatOptions
Chainable Setters
Sourcepub fn with_temperature(self, value: f64) -> Self
pub fn with_temperature(self, value: f64) -> Self
Sets the sampling temperature.
Sourcepub fn with_max_tokens(self, value: u32) -> Self
pub fn with_max_tokens(self, value: u32) -> Self
Sets the maximum number of output tokens.
Sourcepub fn with_top_p(self, value: f64) -> Self
pub fn with_top_p(self, value: f64) -> Self
Sets nucleus sampling (top-p).
Sourcepub fn with_capture_usage(self, value: bool) -> Self
pub fn with_capture_usage(self, value: bool) -> Self
Enables or disables capturing usage in streaming mode.
Sourcepub fn with_capture_content(self, value: bool) -> Self
pub fn with_capture_content(self, value: bool) -> Self
Enables or disables capturing concatenated content in streaming mode.
Sourcepub fn with_capture_reasoning_content(self, value: bool) -> Self
pub fn with_capture_reasoning_content(self, value: bool) -> Self
Enables or disables capturing concatenated reasoning content in streaming mode.
Sourcepub fn with_capture_tool_calls(self, value: bool) -> Self
pub fn with_capture_tool_calls(self, value: bool) -> Self
Enables or disables capturing tool calls in streaming mode.
Sourcepub fn with_capture_raw_body(self, value: bool) -> Self
pub fn with_capture_raw_body(self, value: bool) -> Self
Enables or disables capturing the raw HTTP body.
Sourcepub fn with_stop_sequences(self, values: Vec<String>) -> Self
pub fn with_stop_sequences(self, values: Vec<String>) -> Self
Sets the stop sequences.
Sourcepub fn with_normalize_reasoning_content(self, value: bool) -> Self
pub fn with_normalize_reasoning_content(self, value: bool) -> Self
Enables or disables normalization of reasoning content (e.g., <think>...</think>).
Sourcepub fn with_response_format(
self,
res_format: impl Into<ChatResponseFormat>,
) -> Self
pub fn with_response_format( self, res_format: impl Into<ChatResponseFormat>, ) -> Self
Sets the response format.
Sourcepub fn with_reasoning_effort(self, value: ReasoningEffort) -> Self
pub fn with_reasoning_effort(self, value: ReasoningEffort) -> Self
Sets the reasoning effort hint.
Sourcepub fn with_verbosity(self, value: Verbosity) -> Self
pub fn with_verbosity(self, value: Verbosity) -> Self
Sets the verbosity hint.
Sourcepub fn with_service_tier(self, value: ServiceTier) -> Self
pub fn with_service_tier(self, value: ServiceTier) -> Self
Sets the service tier preference (OpenAI-specific).
Sourcepub fn with_extra_headers(self, headers: impl Into<Headers>) -> Self
pub fn with_extra_headers(self, headers: impl Into<Headers>) -> Self
Adds extra HTTP headers.
Sourcepub fn with_json_mode(self, value: bool) -> Self
👎Deprecated: Use with_response_format(ChatResponseFormat::JsonMode)
pub fn with_json_mode(self, value: bool) -> Self
Deprecated: use with_response_format(ChatResponseFormat::JsonMode).
When using JSON mode, you should still instruct the model to produce JSON in your prompt for broad provider compatibility (e.g., mention “json” in system/user messages).
Trait Implementations§
Source§impl Clone for ChatOptions
impl Clone for ChatOptions
Source§fn clone(&self) -> ChatOptions
fn clone(&self) -> ChatOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more