pub struct SamplingOverrides {
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub max_tokens: Option<u32>,
}Expand description
Per-call sampling overrides for ChatProvider methods.
Backends that support per-call sampling (e.g. LlamaCppProvider) apply
these overrides on top of the defaults configured at provider construction.
Backends that do not support per-call overrides (the default trait impl)
silently ignore overrides — passing Some(SamplingOverrides::...) is safe
against any backend.
None on any field means “use the provider default” (no override). Passing
sampling: None to the _and_sampling methods is equivalent to calling
the non-sampling-aware method (no behaviour change).
Fields§
§temperature: Option<f32>Temperature override. None = use provider default.
top_p: Option<f32>Top-p (nucleus sampling) override. None = use provider default.
max_tokens: Option<u32>Max output tokens override. None = use provider default.
Implementations§
Source§impl SamplingOverrides
impl SamplingOverrides
Sourcepub fn empty() -> Self
pub fn empty() -> Self
All overrides unset. Equivalent to SamplingOverrides::default —
included for call-site readability when explicitly opting out.
Sourcepub fn with_temperature(temperature: f32) -> Self
pub fn with_temperature(temperature: f32) -> Self
Convenience constructor: override only temperature.
Sourcepub fn with_top_p(top_p: f32) -> Self
pub fn with_top_p(top_p: f32) -> Self
Convenience constructor: override only top_p.
Sourcepub fn with_max_tokens(max_tokens: u32) -> Self
pub fn with_max_tokens(max_tokens: u32) -> Self
Convenience constructor: override only max_tokens.
Trait Implementations§
Source§impl Clone for SamplingOverrides
impl Clone for SamplingOverrides
Source§fn clone(&self) -> SamplingOverrides
fn clone(&self) -> SamplingOverrides
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SamplingOverrides
impl Debug for SamplingOverrides
Source§impl Default for SamplingOverrides
impl Default for SamplingOverrides
Source§fn default() -> SamplingOverrides
fn default() -> SamplingOverrides
Source§impl PartialEq for SamplingOverrides
impl PartialEq for SamplingOverrides
Source§fn eq(&self, other: &SamplingOverrides) -> bool
fn eq(&self, other: &SamplingOverrides) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SamplingOverrides
Auto Trait Implementations§
impl Freeze for SamplingOverrides
impl RefUnwindSafe for SamplingOverrides
impl Send for SamplingOverrides
impl Sync for SamplingOverrides
impl Unpin for SamplingOverrides
impl UnsafeUnpin for SamplingOverrides
impl UnwindSafe for SamplingOverrides
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
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: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more