pub struct CompletionRequest {
pub model: String,
pub messages: Vec<Message>,
pub max_tokens: u32,
pub system: Option<String>,
pub tools: Vec<ToolDefinition>,
pub stream: bool,
pub temperature: Option<f32>,
pub stop_sequences: Vec<String>,
pub thinking: Option<ThinkingConfig>,
}Expand description
A completion request to send to an LLM provider.
Fields§
§model: StringThe model identifier.
messages: Vec<Message>The conversation messages.
max_tokens: u32Maximum tokens to generate.
system: Option<String>Optional system prompt.
tools: Vec<ToolDefinition>Available tools.
stream: boolWhether to stream the response.
temperature: Option<f32>Sampling temperature (0.0-1.0).
stop_sequences: Vec<String>Stop sequences.
thinking: Option<ThinkingConfig>Extended thinking configuration.
Implementations§
Source§impl CompletionRequest
impl CompletionRequest
Sourcepub fn new(
model: impl Into<String>,
messages: Vec<Message>,
max_tokens: u32,
) -> Self
pub fn new( model: impl Into<String>, messages: Vec<Message>, max_tokens: u32, ) -> Self
Create a new request with required fields.
Sourcepub fn temperature(self, temp: f32) -> Self
pub fn temperature(self, temp: f32) -> Self
Set the temperature.
Sourcepub fn tools(self, tools: Vec<ToolDefinition>) -> Self
pub fn tools(self, tools: Vec<ToolDefinition>) -> Self
Add tools.
Sourcepub fn thinking(self, config: ThinkingConfig) -> Self
pub fn thinking(self, config: ThinkingConfig) -> Self
Set extended thinking configuration.
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompletionRequest
impl Debug for CompletionRequest
Auto Trait Implementations§
impl Freeze for CompletionRequest
impl RefUnwindSafe for CompletionRequest
impl Send for CompletionRequest
impl Sync for CompletionRequest
impl Unpin for CompletionRequest
impl UnwindSafe for CompletionRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more