pub struct SamplingParams {Show 16 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,
pub structured_output_start: StructuredOutputStart,
pub response_completion_boundary: ResponseCompletionBoundary,
}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.)
structured_output_start: StructuredOutputStartPoint at which a structured-output grammar starts constraining model output. Thinking templates can open a reasoning block in the prompt; in that case the grammar activates only after the typed delimiter.
response_completion_boundary: ResponseCompletionBoundaryProduct completion boundary that must be satisfied before model EOS tokens may terminate generation.
This is independent of structured-output grammar activation: ordinary text and structured responses need a complete reasoning-to-payload transition when the rendered prompt opens one. A complete lexical response envelope, such as a tool call, is an alternate terminal path.
Implementations§
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