#[non_exhaustive]pub struct SamplingRequest {
pub messages: Vec<SamplingMessage>,
pub model_preferences: Option<ModelPreferences>,
pub system_prompt: Option<String>,
pub max_tokens: u32,
pub temperature: Option<f32>,
pub stop_sequences: Option<Vec<String>>,
}Expand description
One sampling/createMessage request envelope sent from a klieo MCP
server to its client. Carries the message history plus optional
model preferences, a system prompt, sampling controls, and an upper
bound on the number of tokens the client may generate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.messages: Vec<SamplingMessage>Conversation history the client should complete. Ordered oldest-first; the client’s reply continues from the last entry.
model_preferences: Option<ModelPreferences>Optional hints to the client about which model family / cost / latency / intelligence profile to use. Clients MAY ignore these and pick their own model.
system_prompt: Option<String>Optional system prompt to prepend to the conversation. When
None, the client uses its own default (or no system prompt).
max_tokens: u32Upper bound on the number of tokens the client may generate. Required by the MCP spec; clients MUST honour it.
temperature: Option<f32>Optional sampling temperature. Range and default are client-defined; common practice is 0.0–2.0 with 1.0 as default.
stop_sequences: Option<Vec<String>>Optional list of stop sequences. Generation halts as soon as the model emits any of these strings.
Implementations§
Source§impl SamplingRequest
impl SamplingRequest
Sourcepub fn new(messages: Vec<SamplingMessage>, max_tokens: u32) -> Self
pub fn new(messages: Vec<SamplingMessage>, max_tokens: u32) -> Self
Constructs a new SamplingRequest with required fields.
Optional fields default to None.
Trait Implementations§
Source§impl Clone for SamplingRequest
impl Clone for SamplingRequest
Source§fn clone(&self) -> SamplingRequest
fn clone(&self) -> SamplingRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more