pub struct ChatRequest {
pub model: String,
pub messages: Vec<ChatMessage>,
pub tools: Vec<ToolDefinition>,
pub stream: Option<bool>,
pub temperature: Option<f64>,
}Fields§
§model: StringID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.
messages: Vec<ChatMessage>A list of messages comprising the conversation so far.
tools: Vec<ToolDefinition>A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
stream: Option<bool>If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
temperature: Option<f64>What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.
Implementations§
Source§impl ChatRequest
impl ChatRequest
pub fn new( model: impl Into<String>, messages: impl Into<Vec<ChatMessage>>, ) -> Self
pub fn new_with_tools( model: impl Into<String>, messages: impl Into<Vec<ChatMessage>>, tools: impl Into<Vec<ToolDefinition>>, ) -> Self
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 more