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 meta: Option<RequestMeta>,
}Expand description
sampling/createMessage request params.
Sent from server to client to request an LLM completion.
Fields§
§messages: Vec<SamplingMessage>Conversation messages.
max_tokens: u32Maximum tokens to generate.
system_prompt: Option<String>Optional system prompt.
temperature: Option<f64>Sampling temperature (0.0 to 2.0).
stop_sequences: Vec<String>Stop sequences to end generation.
model_preferences: Option<ModelPreferences>Model preferences/hints.
include_context: Option<IncludeContext>Include context from MCP servers.
meta: Option<RequestMeta>Request metadata.
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
Creates a new sampling request with default settings.
Sourcepub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Sets the system prompt.
Sourcepub fn with_temperature(self, temp: f64) -> Self
pub fn with_temperature(self, temp: f64) -> Self
Sets the sampling temperature.
Sourcepub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
pub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
Adds stop sequences.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).