pub struct SamplingParams {Show 14 fields
pub max_tokens: usize,
pub temperature: f32,
pub top_p: f32,
pub top_k: Option<usize>,
pub repetition_penalty: f32,
pub presence_penalty: f32,
pub frequency_penalty: f32,
pub stop_sequences: Vec<String>,
pub seed: Option<u64>,
pub min_p: Option<f32>,
pub tfs: Option<f32>,
pub typical_p: Option<f32>,
pub mirostat: Option<MirostatParams>,
pub response_format: ResponseFormat,
}Expand description
Sampling parameters for generation
Fields§
§max_tokens: usizeMaximum number of tokens to generate
temperature: f32Temperature for randomness (0.0 = deterministic, higher = more random)
top_p: f32Nucleus sampling probability threshold
top_k: Option<usize>Top-k sampling - consider only top k tokens
repetition_penalty: f32Repetition penalty to reduce repetitive text
presence_penalty: f32Presence penalty for token diversity
frequency_penalty: f32Frequency penalty based on token frequency
stop_sequences: Vec<String>Stop sequences to end generation
seed: Option<u64>Random seed for reproducible generation
min_p: Option<f32>Minimum probability threshold for tokens
tfs: Option<f32>Tail free sampling parameter
typical_p: Option<f32>Typical sampling parameter
mirostat: Option<MirostatParams>Mirostat sampling parameters
response_format: ResponseFormatResponse format constraint (JSON mode, schema-constrained, etc.)
Implementations§
Source§impl SamplingParams
impl SamplingParams
Sourcepub fn greedy() -> SamplingParams
pub fn greedy() -> SamplingParams
Create greedy sampling parameters (deterministic)
Sourcepub fn with_temperature(temperature: f32) -> SamplingParams
pub fn with_temperature(temperature: f32) -> SamplingParams
Create default sampling parameters with temperature
Sourcepub fn validate(&self) -> Result<(), FerrumError>
pub fn validate(&self) -> Result<(), FerrumError>
Validate sampling parameters
Trait Implementations§
Source§impl Clone for SamplingParams
impl Clone for SamplingParams
Source§fn clone(&self) -> SamplingParams
fn clone(&self) -> SamplingParams
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 moreSource§impl Debug for SamplingParams
impl Debug for SamplingParams
Source§impl Default for SamplingParams
impl Default for SamplingParams
Source§fn default() -> SamplingParams
fn default() -> SamplingParams
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SamplingParams
impl<'de> Deserialize<'de> for SamplingParams
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SamplingParams, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SamplingParams, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SamplingParams
impl Serialize for SamplingParams
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for SamplingParams
impl RefUnwindSafe for SamplingParams
impl Send for SamplingParams
impl Sync for SamplingParams
impl Unpin for SamplingParams
impl UnsafeUnpin for SamplingParams
impl UnwindSafe for SamplingParams
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