pub struct ChatRequest {Show 19 fields
pub model: String,
pub messages: Vec<ChatMessage>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub response_format: Option<Value>,
pub max_completion_tokens: Option<u32>,
pub tools: Option<Value>,
pub tool_choice: Option<Value>,
pub parallel_tool_calls: Option<bool>,
pub stop: Option<Value>,
pub top_p: Option<f32>,
pub presence_penalty: Option<f32>,
pub frequency_penalty: Option<f32>,
pub seed: Option<u64>,
pub user: Option<String>,
pub metadata: Option<Value>,
pub reasoning_effort: Option<Value>,
pub thinking: Option<Value>,
pub extra_body: Option<Map<String, Value>>,
}Fields§
§model: String§messages: Vec<ChatMessage>§temperature: Option<f32>§max_tokens: Option<u32>§response_format: Option<Value>§max_completion_tokens: Option<u32>§tools: Option<Value>§tool_choice: Option<Value>§parallel_tool_calls: Option<bool>§stop: Option<Value>§top_p: Option<f32>§presence_penalty: Option<f32>§frequency_penalty: Option<f32>§seed: Option<u64>§user: Option<String>§metadata: Option<Value>§reasoning_effort: Option<Value>§thinking: Option<Value>§extra_body: Option<Map<String, Value>>Provider-specific JSON body fields forwarded at the top level.
Values are sent raw to the upstream provider. Core request fields and LiteLLM-internal-looking keys are rejected when the request is built.
Implementations§
Source§impl ChatRequest
impl ChatRequest
pub fn new(model: impl Into<String>) -> Self
pub fn message( self, role: impl Into<String>, content: impl Into<String>, ) -> Self
pub fn message_with_content( self, role: impl Into<String>, content: ChatMessageContent, ) -> Self
pub fn temperature(self, temperature: f32) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
pub fn response_format(self, format: Value) -> Self
pub fn extra_body(self, body: Map<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§impl Debug for ChatRequest
impl Debug for ChatRequest
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
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