pub struct MessageBuilder { /* private fields */ }Expand description
Builder for creating sampling messages and requests at runtime
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn max_tokens(self, max_tokens: u32) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
Set maximum tokens for response generation
Sourcepub fn message(self, message: SamplingMessage) -> Self
pub fn message(self, message: SamplingMessage) -> Self
Add a message to the conversation
Sourcepub fn user_text(self, content: impl Into<String>) -> Self
pub fn user_text(self, content: impl Into<String>) -> Self
Add a user message with text content
Sourcepub fn user_image(
self,
data: impl Into<String>,
mime_type: impl Into<String>,
) -> Self
pub fn user_image( self, data: impl Into<String>, mime_type: impl Into<String>, ) -> Self
Add a user message with image content
Sourcepub fn assistant_text(self, content: impl Into<String>) -> Self
pub fn assistant_text(self, content: impl Into<String>) -> Self
Add an assistant message with text content
Sourcepub fn model_preferences(self, preferences: ModelPreferences) -> Self
pub fn model_preferences(self, preferences: ModelPreferences) -> Self
Set model preferences
Sourcepub fn with_model_preferences<F>(self, f: F) -> Self
pub fn with_model_preferences<F>(self, f: F) -> Self
Create and set model preferences with builder pattern
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> Self
pub fn system_prompt(self, prompt: impl Into<String>) -> Self
Set system prompt
Sourcepub fn include_context(self, context: impl Into<String>) -> Self
pub fn include_context(self, context: impl Into<String>) -> Self
Set include context
Sourcepub fn temperature(self, temperature: f64) -> Self
pub fn temperature(self, temperature: f64) -> Self
Set temperature for sampling (0.0-1.0)
Sourcepub fn stop_sequences(self, sequences: Vec<String>) -> Self
pub fn stop_sequences(self, sequences: Vec<String>) -> Self
Set stop sequences
Sourcepub fn stop_sequence(self, sequence: impl Into<String>) -> Self
pub fn stop_sequence(self, sequence: impl Into<String>) -> Self
Add a stop sequence
Sourcepub fn build_params(self) -> CreateMessageParams
pub fn build_params(self) -> CreateMessageParams
Build a CreateMessageParams
Sourcepub fn build_request(self) -> CreateMessageRequest
pub fn build_request(self) -> CreateMessageRequest
Build a complete CreateMessageRequest
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageBuilder
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnwindSafe for MessageBuilder
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