pub struct CreateMessageRequest {
pub model: String,
pub messages: Vec<Message>,
pub max_tokens: usize,
pub system: Option<String>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub stop_sequences: Option<Vec<String>>,
pub tools: Option<Vec<Tool>>,
pub stream: Option<bool>,
}Expand description
Request to create a message.
Fields§
§model: StringModel to use.
messages: Vec<Message>Messages in the conversation.
max_tokens: usizeMaximum tokens to generate.
system: Option<String>System prompt.
temperature: Option<f32>Temperature for sampling.
top_p: Option<f32>Top-p sampling.
stop_sequences: Option<Vec<String>>Stop sequences.
tools: Option<Vec<Tool>>Available tools.
stream: Option<bool>Whether to stream the response.
Implementations§
Source§impl CreateMessageRequest
impl CreateMessageRequest
Sourcepub fn new(
model: impl Into<String>,
messages: Vec<Message>,
max_tokens: usize,
) -> Self
pub fn new( model: impl Into<String>, messages: Vec<Message>, max_tokens: usize, ) -> Self
Create a new message request.
Sourcepub fn with_system(self, system: impl Into<String>) -> Self
pub fn with_system(self, system: impl Into<String>) -> Self
Set the system prompt.
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature.
Sourcepub fn with_top_p(self, top_p: f32) -> Self
pub fn with_top_p(self, top_p: f32) -> Self
Set top-p sampling.
Sourcepub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
pub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
Set stop sequences.
Sourcepub fn with_tools(self, tools: Vec<Tool>) -> Self
pub fn with_tools(self, tools: Vec<Tool>) -> Self
Set available tools.
Trait Implementations§
Source§impl Clone for CreateMessageRequest
impl Clone for CreateMessageRequest
Source§fn clone(&self) -> CreateMessageRequest
fn clone(&self) -> CreateMessageRequest
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 CreateMessageRequest
impl Debug for CreateMessageRequest
Auto Trait Implementations§
impl Freeze for CreateMessageRequest
impl RefUnwindSafe for CreateMessageRequest
impl Send for CreateMessageRequest
impl Sync for CreateMessageRequest
impl Unpin for CreateMessageRequest
impl UnwindSafe for CreateMessageRequest
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