pub struct CreateMessageParams {
pub messages: Vec<SamplingMessage>,
pub max_tokens: u32,
pub system_prompt: Option<String>,
pub temperature: Option<f64>,
pub stop_sequences: Vec<String>,
pub model_preferences: Option<ModelPreferences>,
pub include_context: Option<IncludeContext>,
pub metadata: Option<Map<String, Value>>,
pub tools: Option<Vec<SamplingTool>>,
pub tool_choice: Option<ToolChoice>,
}Expand description
Parameters for sampling/createMessage request
Fields§
§messages: Vec<SamplingMessage>The messages to send to the LLM
max_tokens: u32Maximum number of tokens to generate
system_prompt: Option<String>Optional system prompt
temperature: Option<f64>Sampling temperature (0.0 to 1.0)
stop_sequences: Vec<String>Stop sequences
model_preferences: Option<ModelPreferences>Model preferences
include_context: Option<IncludeContext>Context inclusion mode
metadata: Option<Map<String, Value>>Additional metadata
tools: Option<Vec<SamplingTool>>Tools available for the model to use (SEP-1577)
tool_choice: Option<ToolChoice>Tool choice mode (SEP-1577)
Implementations§
Source§impl CreateMessageParams
impl CreateMessageParams
Sourcepub fn new(messages: Vec<SamplingMessage>, max_tokens: u32) -> Self
pub fn new(messages: Vec<SamplingMessage>, max_tokens: u32) -> Self
Create a new sampling request
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> Self
pub fn system_prompt(self, prompt: impl Into<String>) -> Self
Set the system prompt
Sourcepub fn temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Set the temperature
Sourcepub fn stop_sequence(self, seq: impl Into<String>) -> Self
pub fn stop_sequence(self, seq: impl Into<String>) -> Self
Add a stop sequence
Sourcepub fn model_preferences(self, prefs: ModelPreferences) -> Self
pub fn model_preferences(self, prefs: ModelPreferences) -> Self
Set model preferences
Sourcepub fn include_context(self, mode: IncludeContext) -> Self
pub fn include_context(self, mode: IncludeContext) -> Self
Set context inclusion mode
Sourcepub fn tools(self, tools: Vec<SamplingTool>) -> Self
pub fn tools(self, tools: Vec<SamplingTool>) -> Self
Set tools available for the model to use (SEP-1577)
Sourcepub fn tool_choice(self, choice: ToolChoice) -> Self
pub fn tool_choice(self, choice: ToolChoice) -> Self
Set tool choice mode (SEP-1577)
Trait Implementations§
Source§impl Clone for CreateMessageParams
impl Clone for CreateMessageParams
Source§fn clone(&self) -> CreateMessageParams
fn clone(&self) -> CreateMessageParams
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 CreateMessageParams
impl Debug for CreateMessageParams
Source§impl<'de> Deserialize<'de> for CreateMessageParams
impl<'de> Deserialize<'de> for CreateMessageParams
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 CreateMessageParams
impl RefUnwindSafe for CreateMessageParams
impl Send for CreateMessageParams
impl Sync for CreateMessageParams
impl Unpin for CreateMessageParams
impl UnwindSafe for CreateMessageParams
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