pub struct CallOptions {Show 17 fields
pub prompt: Prompt,
pub max_output_tokens: Option<u32>,
pub temperature: Option<f64>,
pub top_p: Option<f64>,
pub top_k: Option<u32>,
pub presence_penalty: Option<f64>,
pub frequency_penalty: Option<f64>,
pub stop_sequences: Option<Vec<String>>,
pub seed: Option<u64>,
pub response_format: Option<ResponseFormat>,
pub tools: Vec<ToolDefinition>,
pub tool_choice: Option<ToolChoice>,
pub include_raw_chunks: bool,
pub reasoning: ReasoningEffort,
pub headers: Headers,
pub provider_options: ProviderOptions,
pub cancellation: CancellationToken,
}Expand description
Options for a single do_generate or do_stream call.
The core validates and normalizes application settings before building
this struct; adapters translate it into a provider request. Options the
provider does not support must produce a Warning and be
ignored rather than cause an error.
Fields§
§prompt: PromptThe prompt in specification form.
max_output_tokens: Option<u32>Maximum number of output tokens.
temperature: Option<f64>Sampling temperature.
top_p: Option<f64>Nucleus sampling probability mass.
top_k: Option<u32>Top-k sampling.
presence_penalty: Option<f64>Presence penalty.
frequency_penalty: Option<f64>Frequency penalty.
stop_sequences: Option<Vec<String>>Stop sequences.
seed: Option<u64>Random seed for deterministic sampling.
response_format: Option<ResponseFormat>Output format (text or JSON with an optional schema).
tools: Vec<ToolDefinition>Tools available to the model.
tool_choice: Option<ToolChoice>Tool choice constraint.
include_raw_chunks: boolWhether the stream should include Raw parts with provider chunks.
reasoning: ReasoningEffortRequested reasoning effort.
headers: HeadersAdditional request headers.
provider_options: ProviderOptionsProvider-specific options keyed by provider name.
cancellation: CancellationTokenCancellation token; when triggered the adapter aborts the request.
Implementations§
Source§impl CallOptions
impl CallOptions
Sourcepub fn new(prompt: Prompt) -> Self
pub fn new(prompt: Prompt) -> Self
Creates call options for prompt with every other field at its default.
Sourcepub fn to_recordable(&self) -> CallOptionsRecord
pub fn to_recordable(&self) -> CallOptionsRecord
Returns a serializable copy without the cancellation token.
Used for fixtures, snapshots and telemetry. Sensitive header values are masked when the record is serialized.
Sourcepub fn provider_options_for(&self, provider_key: &str) -> Option<&JsonObject>
pub fn provider_options_for(&self, provider_key: &str) -> Option<&JsonObject>
Returns the provider options stored under provider_key, if any.
Trait Implementations§
Source§impl Clone for CallOptions
impl Clone for CallOptions
Source§fn clone(&self) -> CallOptions
fn clone(&self) -> CallOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more