pub enum SamplingPreset {
Balanced,
Creative,
Precise,
Greedy,
Conversational,
}Expand description
Named preset for sampling behavior.
§Example
use oxibonsai_runtime::presets::SamplingPreset;
use oxibonsai_runtime::sampling::SamplingParams;
// Use a preset directly
let params: SamplingParams = SamplingPreset::Balanced.into();
assert!((params.temperature - 0.7).abs() < f32::EPSILON);
// Iterate over all presets
for preset in SamplingPreset::all() {
let p = preset.params();
assert!(p.temperature >= 0.0);
assert!(p.top_p >= 0.0 && p.top_p <= 1.0);
}Variants§
Balanced
General use: temp=0.7, top_p=0.9, top_k=40, rep_pen=1.1
Creative
Creative writing: temp=1.0, top_p=0.95, top_k=0 (disabled), rep_pen=1.0
Precise
Factual/code generation: temp=0.1, top_p=0.5, top_k=10, rep_pen=1.2
Greedy
Deterministic output: temp=0.0, greedy decoding
Conversational
Chat/conversation: temp=0.8, top_p=0.9, top_k=50, rep_pen=1.1
Implementations§
Source§impl SamplingPreset
impl SamplingPreset
Sourcepub fn params(&self) -> SamplingParams
pub fn params(&self) -> SamplingParams
Get the sampling parameters for this preset.
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Description of this preset’s intended use case.
Sourcepub fn all() -> &'static [SamplingPreset]
pub fn all() -> &'static [SamplingPreset]
Get all available presets.
Trait Implementations§
Source§impl Clone for SamplingPreset
impl Clone for SamplingPreset
Source§fn clone(&self) -> SamplingPreset
fn clone(&self) -> SamplingPreset
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SamplingPreset
impl Debug for SamplingPreset
Source§impl Display for SamplingPreset
impl Display for SamplingPreset
Source§impl From<SamplingPreset> for SamplingParams
impl From<SamplingPreset> for SamplingParams
Source§fn from(preset: SamplingPreset) -> Self
fn from(preset: SamplingPreset) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SamplingPreset
impl PartialEq for SamplingPreset
Source§fn eq(&self, other: &SamplingPreset) -> bool
fn eq(&self, other: &SamplingPreset) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for SamplingPreset
impl Eq for SamplingPreset
impl StructuralPartialEq for SamplingPreset
Auto Trait Implementations§
impl Freeze for SamplingPreset
impl RefUnwindSafe for SamplingPreset
impl Send for SamplingPreset
impl Sync for SamplingPreset
impl Unpin for SamplingPreset
impl UnsafeUnpin for SamplingPreset
impl UnwindSafe for SamplingPreset
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: 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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more