pub struct SamplingParams {Show 29 fields
pub max_new_tokens: Option<i64>,
pub stop: Option<StrOrList>,
pub stop_token_ids: Option<Vec<i64>>,
pub temperature: f64,
pub top_p: f64,
pub top_k: i64,
pub min_p: f64,
pub frequency_penalty: f64,
pub presence_penalty: f64,
pub repetition_penalty: f64,
pub min_new_tokens: i64,
pub json_schema: Option<String>,
pub regex: Option<String>,
pub ebnf: Option<String>,
pub structural_tag: Option<String>,
pub ignore_eos: bool,
pub skip_special_tokens: bool,
pub spaces_between_special_tokens: bool,
pub no_stop_trim: bool,
pub thinking_budget: Option<i64>,
pub custom_params: Option<Dict<String, Value>>,
pub stream_interval: Option<i64>,
pub logit_bias: Option<Dict<String, f64>>,
pub seed: Option<i64>,
pub logprobs: Option<i64>,
pub n: i64,
pub stop_strs: Option<StrOrList>,
pub stop_str_max_len: i64,
pub is_normalized: bool,
}Expand description
SamplingParams, an untagged array-layout struct nested in a request.
This is the data only. The Python class also normalizes on
construction and decode (__post_init__: greedy for a near-zero
temperature, stop copied to stop_strs, …) unless
is_normalized is set; decoding here applies none of that.
Fields§
§max_new_tokens: Option<i64>Generation length limit; None leaves it to the engine.
stop: Option<StrOrList>API input for stop strings; normalization copies it to stop_strs.
stop_token_ids: Option<Vec<i64>>Token ids that end generation (a Python set).
temperature: f64Sampling temperature.
top_p: f64Nucleus sampling mass.
top_k: i64Top-k cutoff; -1 disables it before normalization.
min_p: f64Minimum probability relative to the most likely token.
frequency_penalty: f64Frequency penalty.
presence_penalty: f64Presence penalty.
repetition_penalty: f64Repetition penalty.
min_new_tokens: i64Tokens generated before stop conditions apply.
json_schema: Option<String>JSON schema constraint.
regex: Option<String>Regex constraint.
ebnf: Option<String>EBNF grammar constraint.
structural_tag: Option<String>Structural tag constraint.
ignore_eos: boolKeep generating past end-of-sequence tokens.
skip_special_tokens: boolDetokenization option, carried for the frontend.
spaces_between_special_tokens: boolDetokenization option, carried for the frontend.
no_stop_trim: boolKeep the matched stop string in the output.
thinking_budget: Option<i64>Reasoning-token budget.
custom_params: Option<Dict<String, Value>>Free-form parameters for custom logit processors.
stream_interval: Option<i64>Streaming chunk interval in tokens.
logit_bias: Option<Dict<String, f64>>Per-token logit offsets, keyed by token id as a string.
seed: Option<i64>Sampling seed.
logprobs: Option<i64>Output logprobs: None off, 0 the sampled token’s logprob.
n: i64OpenAI n; the engine accepts only 1.
stop_strs: Option<StrOrList>Stop strings after normalization.
stop_str_max_len: i64Longest stop string, set by normalization.
is_normalized: boolWhether normalization already ran on the sender.