pub struct ChatRequest {
pub model: String,
pub messages: Vec<ChatMessage>,
pub tools: Option<Vec<ChatTool>>,
pub stream: Option<bool>,
pub temperature: Option<f64>,
pub max_tokens: Option<i32>,
pub provider_options: Option<HashMap<String, Value>>,
}Expand description
Request body for text generation.
Fields§
§model: StringModel ID that determines provider routing (e.g. “claude-sonnet-4-6”, “grok-4-1-fast-non-reasoning”).
messages: Vec<ChatMessage>Conversation history.
tools: Option<Vec<ChatTool>>Functions the model can call.
stream: Option<bool>Enables server-sent event streaming. Set automatically by chat_stream.
temperature: Option<f64>Controls randomness (0.0-2.0).
max_tokens: Option<i32>Limits the response length.
provider_options: Option<HashMap<String, Value>>Provider-specific settings (e.g. Anthropic thinking, xAI search).
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 · 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
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