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>,
pub task: Option<TaskRequestParams>,
pub meta: Option<Value>,
}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)
task: Option<TaskRequestParams>Task parameters for async execution
meta: Option<Value>Optional protocol-level metadata
Implementations§
Source§impl CreateMessageParams
impl CreateMessageParams
Sourcepub fn new(
messages: Vec<SamplingMessage>,
max_tokens: u32,
) -> CreateMessageParams
pub fn new( messages: Vec<SamplingMessage>, max_tokens: u32, ) -> CreateMessageParams
Create a new sampling request
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> CreateMessageParams
pub fn system_prompt(self, prompt: impl Into<String>) -> CreateMessageParams
Set the system prompt
Sourcepub fn temperature(self, temp: f64) -> CreateMessageParams
pub fn temperature(self, temp: f64) -> CreateMessageParams
Set the temperature
Sourcepub fn stop_sequence(self, seq: impl Into<String>) -> CreateMessageParams
pub fn stop_sequence(self, seq: impl Into<String>) -> CreateMessageParams
Add a stop sequence
Sourcepub fn model_preferences(self, prefs: ModelPreferences) -> CreateMessageParams
pub fn model_preferences(self, prefs: ModelPreferences) -> CreateMessageParams
Set model preferences
Sourcepub fn include_context(self, mode: IncludeContext) -> CreateMessageParams
pub fn include_context(self, mode: IncludeContext) -> CreateMessageParams
Set context inclusion mode
Sourcepub fn tools(self, tools: Vec<SamplingTool>) -> CreateMessageParams
pub fn tools(self, tools: Vec<SamplingTool>) -> CreateMessageParams
Set tools available for the model to use (SEP-1577)
Sourcepub fn tool_choice(self, choice: ToolChoice) -> CreateMessageParams
pub fn tool_choice(self, choice: ToolChoice) -> CreateMessageParams
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<CreateMessageParams, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateMessageParams, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for CreateMessageParams
impl Serialize for CreateMessageParams
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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 UnsafeUnpin 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