pub struct ChatCompletionRequest {Show 15 fields
pub model: String,
pub messages: Vec<Message>,
pub temperature: f32,
pub top_p: f32,
pub n: u32,
pub stream: bool,
pub stop: Option<Vec<String>>,
pub max_tokens: Option<u32>,
pub presence_penalty: f32,
pub frequency_penalty: f32,
pub user: Option<String>,
pub response_format: Option<ResponseFormat>,
pub seed: Option<u64>,
pub tools: Vec<Tool>,
pub tool_choice: Option<ToolChoice>,
}Expand description
Chat completion request - matches OpenAI schema exactly
Fields§
§model: StringModel to use (e.g., “gpt-4”, “llama-3.1-70b”)
messages: Vec<Message>Messages in the conversation
temperature: f32Sampling temperature (0-2)
top_p: f32Top-p nucleus sampling
n: u32Number of completions to generate
stream: boolWhether to stream responses
stop: Option<Vec<String>>Stop sequences
max_tokens: Option<u32>Maximum tokens to generate
presence_penalty: f32Presence penalty (-2 to 2)
frequency_penalty: f32Frequency penalty (-2 to 2)
user: Option<String>User identifier for abuse detection
response_format: Option<ResponseFormat>Response format
seed: Option<u64>Seed for deterministic outputs
tools: Vec<Tool>Tool/function definitions
tool_choice: Option<ToolChoice>How to handle tool calls
Trait Implementations§
Source§impl Clone for ChatCompletionRequest
impl Clone for ChatCompletionRequest
Source§fn clone(&self) -> ChatCompletionRequest
fn clone(&self) -> ChatCompletionRequest
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 ChatCompletionRequest
impl Debug for ChatCompletionRequest
Source§impl Default for ChatCompletionRequest
impl Default for ChatCompletionRequest
Source§impl<'de> Deserialize<'de> for ChatCompletionRequest
impl<'de> Deserialize<'de> for ChatCompletionRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChatCompletionRequest
impl RefUnwindSafe for ChatCompletionRequest
impl Send for ChatCompletionRequest
impl Sync for ChatCompletionRequest
impl Unpin for ChatCompletionRequest
impl UnsafeUnpin for ChatCompletionRequest
impl UnwindSafe for ChatCompletionRequest
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