pub struct ChatRequest {Show 17 fields
pub model: String,
pub messages: Vec<ChatMessage>,
pub stream: Option<bool>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub max_tokens: Option<u32>,
pub max_completion_tokens: Option<u32>,
pub stop: Option<Stop>,
pub n: Option<u32>,
pub seed: Option<i64>,
pub frequency_penalty: Option<f32>,
pub presence_penalty: Option<f32>,
pub tools: Vec<ToolDef>,
pub tool_choice: Option<ToolChoice>,
pub response_format: Option<ResponseFormat>,
pub reasoning_effort: Option<String>,
pub extra: Option<Map<String, Value>>,
}Expand description
POST /v1/chat/completions request body.
Fields§
§model: String§messages: Vec<ChatMessage>§stream: Option<bool>§temperature: Option<f32>§top_p: Option<f32>§max_tokens: Option<u32>Legacy token cap. Prefer max_completion_tokens; this is still sent when the
caller set only it.
max_completion_tokens: Option<u32>Modern token cap (takes precedence on the wire).
stop: Option<Stop>§n: Option<u32>§seed: Option<i64>§frequency_penalty: Option<f32>§presence_penalty: Option<f32>§tools: Vec<ToolDef>§tool_choice: Option<ToolChoice>§response_format: Option<ResponseFormat>§reasoning_effort: Option<String>"low" | "medium" | "high".
extra: Option<Map<String, Value>>Dialect-specific passthrough. Its keys are merged at the top level of the request
object (P7 transparent passthrough), so it is #[serde(flatten)]ed here.
Implementations§
Source§impl ChatRequest
impl ChatRequest
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§fn clone(&self) -> ChatRequest
fn clone(&self) -> ChatRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ChatRequest
impl Debug for ChatRequest
Source§impl Default for ChatRequest
impl Default for ChatRequest
Source§fn default() -> ChatRequest
fn default() -> ChatRequest
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChatRequest
impl<'de> Deserialize<'de> for ChatRequest
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
Source§impl PartialEq for ChatRequest
impl PartialEq for ChatRequest
Source§impl Serialize for ChatRequest
impl Serialize for ChatRequest
impl StructuralPartialEq for ChatRequest
Auto Trait Implementations§
impl Freeze for ChatRequest
impl RefUnwindSafe for ChatRequest
impl Send for ChatRequest
impl Sync for ChatRequest
impl Unpin for ChatRequest
impl UnsafeUnpin for ChatRequest
impl UnwindSafe for ChatRequest
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