pub struct SamplingParams { /* private fields */ }Expand description
Owned sampling configuration for one generation request.
Implementations§
Source§impl SamplingParams
impl SamplingParams
pub fn temperature(self, value: f32) -> Self
pub fn top_p(self, value: f32) -> Self
pub fn top_k(self, value: i32) -> Self
pub fn min_p(self, value: f32) -> Self
Sourcepub fn max_tokens(self, value: u32) -> Self
pub fn max_tokens(self, value: u32) -> Self
Sets a finite generation limit.
Zero is invalid; use unbounded to request native
unbounded generation explicitly.
pub fn seed(self, value: u64) -> Self
pub fn clear_seed(self) -> Self
pub fn presence_penalty(self, value: f32) -> Self
pub fn frequency_penalty(self, value: f32) -> Self
pub fn repetition_penalty(self, value: f32) -> Self
pub fn min_tokens(self, value: u32) -> Self
pub fn ignore_eos(self, value: bool) -> Self
pub fn stop(self, value: impl Into<String>) -> Self
pub fn stop_all<I, S>(self, values: I) -> Self
pub fn structured_output(self, value: StructuredOutput) -> Self
Sourcepub fn logits_processor<F>(self, processor: F) -> Self
pub fn logits_processor<F>(self, processor: F) -> Self
Installs a host-side processor that can inspect generated token IDs and mutate one request’s logits before each sampling step.
The processor may run concurrently for different requests, so it must be
Send + Sync. Cloned parameters share the processor. A panic is contained
before the C boundary and reported as Error::LogitsProcessorPanicked
after the bounded generation call or from crate::Request::wait. The
callback state remains registered through the call or request lifetime;
stale native invocations after cleanup become no-ops.
Sourcepub fn clear_logits_processor(self) -> Self
pub fn clear_logits_processor(self) -> Self
Removes a previously configured custom logits processor.
Trait Implementations§
Source§impl Clone for SamplingParams
impl Clone for SamplingParams
Source§fn clone(&self) -> SamplingParams
fn clone(&self) -> SamplingParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more