pub struct SamplingParams {
pub temperature: Option<Decimal>,
pub top_p: Option<Decimal>,
pub top_k: Option<u32>,
pub min_p: Option<Decimal>,
pub presence_penalty: Option<Decimal>,
pub repetition_penalty: Option<Decimal>,
}Expand description
Extended sampling parameters beyond just temperature.
All fields are optional; unset fields use the model’s default.
Serialises to a flat TOML table. Merge via merge.
Fields§
§temperature: Option<Decimal>Sampling temperature (0.0–2.0). Lower values make output more deterministic; higher values increase creativity.
top_p: Option<Decimal>Nucleus sampling threshold (0.0–1.0). Only tokens within the top-p probability mass are considered.
top_k: Option<u32>Hard cutoff: only sample from the K most likely next tokens.
min_p: Option<Decimal>Dynamic minimum probability filter (0.0–1.0). Tokens below this absolute probability are excluded.
presence_penalty: Option<Decimal>Additive penalty for tokens already present in the output (-2.0 to 2.0). Positive values discourage repetition of seen tokens.
repetition_penalty: Option<Decimal>Multiplicative penalty on repeated tokens (1.0–2.0). Values above 1.0 make repeated tokens less likely.
Implementations§
Source§impl SamplingParams
impl SamplingParams
Sourcepub fn merge(&self, other: &Self) -> Self
pub fn merge(&self, other: &Self) -> Self
Override self with values from other, keeping self’s value when
other has a field set to None. Useful for profile layering.
The semantics are simple: for each field, if other has a Some value it
wins; otherwise self’s value (if any) is retained. This makes it ideal
for stacking an overlay profile on top of a base profile — the overlay
only changes what it explicitly sets.