pub struct SamplingRequest {
pub messages: Vec<SamplingRequestMessage>,
pub max_tokens: u32,
pub system_prompt: Option<String>,
pub temperature: Option<f64>,
pub stop_sequences: Vec<String>,
pub model_hints: Vec<String>,
}Expand description
Parameters for a sampling request.
Fields§
§messages: Vec<SamplingRequestMessage>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_hints: Vec<String>Model hints for preference.
Implementations§
Source§impl SamplingRequest
impl SamplingRequest
Sourcepub fn new(messages: Vec<SamplingRequestMessage>, max_tokens: u32) -> Self
pub fn new(messages: Vec<SamplingRequestMessage>, max_tokens: u32) -> Self
Creates a new sampling request with the given messages and max tokens.
Sourcepub fn prompt(text: impl Into<String>, max_tokens: u32) -> Self
pub fn prompt(text: impl Into<String>, max_tokens: u32) -> Self
Creates a simple user prompt request.
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 temperature.
Sourcepub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
pub fn with_stop_sequences(self, sequences: Vec<String>) -> Self
Adds stop sequences.
Sourcepub fn with_model_hints(self, hints: Vec<String>) -> Self
pub fn with_model_hints(self, hints: Vec<String>) -> Self
Adds model hints.
Trait Implementations§
Source§impl Clone for SamplingRequest
impl Clone for SamplingRequest
Source§fn clone(&self) -> SamplingRequest
fn clone(&self) -> SamplingRequest
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 moreAuto Trait Implementations§
impl Freeze for SamplingRequest
impl RefUnwindSafe for SamplingRequest
impl Send for SamplingRequest
impl Sync for SamplingRequest
impl Unpin for SamplingRequest
impl UnwindSafe for SamplingRequest
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).