pub struct CompletionOptions<'a> {
pub model: &'a str,
pub max_tokens: Option<usize>,
pub temperature: Option<f32>,
pub timeout: Option<Duration>,
pub stop_sequences: Vec<String>,
}Expand description
Options for a completion request, passed to LlmProvider::complete_with_options.
Allows callers to supply per-request parameters (max tokens, temperature,
timeout) in addition to the model name, without changing the base
LlmProvider::complete signature.
Fields§
§model: &'a strModel identifier (e.g. "claude-sonnet-4-6", "gpt-4o").
max_tokens: Option<usize>Maximum number of output tokens. Overrides provider defaults when set.
temperature: Option<f32>Sampling temperature in [0.0, 2.0]. Higher = more random.
timeout: Option<Duration>Per-request wall-clock timeout.
stop_sequences: Vec<String>Stop sequences: the model will stop generating when it produces any of these strings. An empty slice means no stop sequences.
Implementations§
Source§impl<'a> CompletionOptions<'a>
impl<'a> CompletionOptions<'a>
Sourcepub fn new(model: &'a str) -> Self
pub fn new(model: &'a str) -> Self
Create options with just a model name and all other fields unset.
Sourcepub fn with_max_tokens(self, n: usize) -> Self
pub fn with_max_tokens(self, n: usize) -> Self
Set the maximum output tokens.
Sourcepub fn with_temperature(self, t: f32) -> Self
pub fn with_temperature(self, t: f32) -> Self
Set the sampling temperature.
Sourcepub fn with_timeout(self, d: Duration) -> Self
pub fn with_timeout(self, d: Duration) -> Self
Set the per-request timeout.
Sourcepub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
pub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
Set stop sequences for this request.
Sourcepub fn with_timeout_secs(self, secs: u64) -> Self
pub fn with_timeout_secs(self, secs: u64) -> Self
Set the per-request timeout from a number of seconds.
Sourcepub fn with_timeout_ms(self, ms: u64) -> Self
pub fn with_timeout_ms(self, ms: u64) -> Self
Set the per-request timeout from a number of milliseconds.
Sourcepub fn has_stop_sequences(&self) -> bool
pub fn has_stop_sequences(&self) -> bool
Return true if at least one stop sequence has been configured.
Sourcepub fn stop_sequence_count(&self) -> usize
pub fn stop_sequence_count(&self) -> usize
Return the number of stop sequences configured.