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: Vec<String>,
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<String>,
}Fields§
§model: String§messages: Vec<ChatMessage>§stream: Option<bool>§temperature: Option<f32>§top_p: Option<f32>§max_tokens: Option<u32>legacy name
max_completion_tokens: Option<u32>modern name (takes precedence)
stop: Vec<String>wire accepts string or array
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<String>Dialect-specific passthrough, spliced verbatim into the request body (P7).
raw JSON object
Implementations§
Source§impl ChatRequest
impl ChatRequest
Sourcepub fn stream(&self) -> bool
pub fn stream(&self) -> bool
Returns the value of stream, or the default value if stream is unset.
Sourcepub fn temperature(&self) -> f32
pub fn temperature(&self) -> f32
Returns the value of temperature, or the default value if temperature is unset.
Sourcepub fn max_tokens(&self) -> u32
pub fn max_tokens(&self) -> u32
Returns the value of max_tokens, or the default value if max_tokens is unset.
Sourcepub fn max_completion_tokens(&self) -> u32
pub fn max_completion_tokens(&self) -> u32
Returns the value of max_completion_tokens, or the default value if max_completion_tokens is unset.
Sourcepub fn frequency_penalty(&self) -> f32
pub fn frequency_penalty(&self) -> f32
Returns the value of frequency_penalty, or the default value if frequency_penalty is unset.
Sourcepub fn presence_penalty(&self) -> f32
pub fn presence_penalty(&self) -> f32
Returns the value of presence_penalty, or the default value if presence_penalty is unset.
Sourcepub fn reasoning_effort(&self) -> &str
pub fn reasoning_effort(&self) -> &str
Returns the value of reasoning_effort, or the default value if reasoning_effort is unset.
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§fn clone(&self) -> ChatRequest
fn clone(&self) -> ChatRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChatRequest
impl Debug for ChatRequest
Source§impl Default for ChatRequest
impl Default for ChatRequest
Source§impl Message for ChatRequest
impl Message for ChatRequest
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.