pub struct CompletionRequest {
pub messages: Vec<Message>,
pub tools: Vec<ToolDefinition>,
pub temperature: Option<f64>,
pub max_tokens: Option<u32>,
pub thinking: Option<bool>,
pub extra: Option<Value>,
}Expand description
Everything a completion model needs to generate a response.
Fields§
§messages: Vec<Message>Conversation history, including the latest user turn.
tools: Vec<ToolDefinition>Tools the model is allowed to call.
temperature: Option<f64>Optional sampling temperature (provider-specific range).
max_tokens: Option<u32>Optional maximum number of tokens to generate.
thinking: Option<bool>Explicitly turn the model’s extended-thinking / reasoning mode on or
off for this request. None leaves the provider’s own default
behavior untouched.
Each provider translates this into its own wire format — there’s no universal “thinking” knob across vendors, so treat this as best-effort:
- DeepSeek:
thinking: {"type": "enabled" | "disabled"}. - Anthropic:
thinking: {"type": "adaptive"}whentrue,{"type": "disabled"}whenfalse. Matches Claude 4.6 and newer; older dated snapshots (pre-4.6) don’t support this and may reject the request — seeanthropic. - Gemini:
generationConfig.thinkingConfig(thinkingBudget: -1/0,includeThoughts). Some Gemini 3 models (e.g.gemini-3.1-pro-preview) can’t fully disable thinking — Google’s own docs note this — sofalsemay not be honored there. - OpenAI:
reasoning_effort: "high" | "minimal". Only o-series/GPT-5-family models support this; sending it to a non-reasoning model (e.g.gpt-4o) will likely error.
Regardless of this setting, a provider’s raw reasoning trace (when it
returns one) never ends up in CompletionResponse::choice — see
CompletionResponse::reasoning.
extra: Option<Value>Provider-specific extra parameters (passed through as-is).
Implementations§
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more