pub struct ChatRequest {
pub model: String,
pub system: Option<String>,
pub messages: Vec<Message>,
pub tools: Vec<Tool>,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
}Expand description
Provider-neutral chat request.
Fields§
§model: String§system: Option<String>System prompt. Sent as a system message to OpenAI and as the top-level
system field to Anthropic.
messages: Vec<Message>§tools: Vec<Tool>§max_tokens: Option<u32>Required by Anthropic; DEFAULT_MAX_TOKENS is used when unset.
temperature: Option<f32>Anthropic accepts 0.0–1.0, and newer Anthropic models accept only 1.0. Leave unset unless the model supports it.
Implementations§
Source§impl ChatRequest
impl ChatRequest
pub fn new(model: impl Into<String>) -> Self
pub fn system(self, system: impl Into<String>) -> Self
pub fn message(self, message: Message) -> Self
pub fn tool(self, tool: Tool) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
pub fn temperature(self, temperature: f32) -> Self
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§impl Debug for ChatRequest
impl Debug 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