pub struct SamplingRequestBuilder { /* private fields */ }Expand description
Builder for creating sampling requests.
Implementations§
Source§impl SamplingRequestBuilder
impl SamplingRequestBuilder
Sourcepub fn user_message(self, content: impl Into<String>) -> Self
pub fn user_message(self, content: impl Into<String>) -> Self
Add a user message.
Sourcepub fn assistant_message(self, content: impl Into<String>) -> Self
pub fn assistant_message(self, content: impl Into<String>) -> Self
Add an assistant message (for multi-turn conversations).
Sourcepub fn message(self, message: SamplingMessage) -> Self
pub fn message(self, message: SamplingMessage) -> Self
Add a raw message with role and content.
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 max_tokens(self, tokens: u32) -> Self
pub fn max_tokens(self, tokens: u32) -> Self
Set maximum tokens for the response.
Sourcepub fn stop_sequences(self, sequences: Vec<String>) -> Self
pub fn stop_sequences(self, sequences: Vec<String>) -> Self
Set stop sequences.
Sourcepub fn temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Set temperature for sampling.
Sourcepub fn model_preferences(self, prefs: ModelPreferences) -> Self
pub fn model_preferences(self, prefs: ModelPreferences) -> Self
Set model preferences.
Sourcepub fn include_context(self, include: IncludeContext) -> Self
pub fn include_context(self, include: IncludeContext) -> Self
Set whether to include MCP context.
Sourcepub fn build(self) -> CreateMessageRequest
pub fn build(self) -> CreateMessageRequest
Build the request.
Trait Implementations§
Source§impl Clone for SamplingRequestBuilder
impl Clone for SamplingRequestBuilder
Source§fn clone(&self) -> SamplingRequestBuilder
fn clone(&self) -> SamplingRequestBuilder
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 SamplingRequestBuilder
impl Debug for SamplingRequestBuilder
Source§impl Default for SamplingRequestBuilder
impl Default for SamplingRequestBuilder
Source§fn default() -> SamplingRequestBuilder
fn default() -> SamplingRequestBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SamplingRequestBuilder
impl RefUnwindSafe for SamplingRequestBuilder
impl Send for SamplingRequestBuilder
impl Sync for SamplingRequestBuilder
impl Unpin for SamplingRequestBuilder
impl UnsafeUnpin for SamplingRequestBuilder
impl UnwindSafe for SamplingRequestBuilder
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