Skip to main content
Sampling parameters apply to paired and standalone samplers alike. Pass SamplingParams to sample(), with num_samples for the number of completions per prompt. This example continues the sampling client and tokenizer from Sample published weights. It raises the temperature, samples from the 50 most likely tokens at each step, and prints the reply:
The script prints the generated reply. response.sequences holds one entry per requested sample, up to the max_tokens limit or the first stop sequence.

Parameters

number
default:1
Scales the token distribution before sampling. Lower values make output more deterministic, and higher values make it more varied.
number
default:1
Keep the most likely tokens until their combined probability reaches top_p. 1.0 turns off this cut-off. Don’t use it when the samples feed an RL loss; see Min-p sampling.
integer
default:-1
Sample from the top_k most likely tokens. Zero or a negative value turns off this cut-off.
integer
Maximum tokens to generate. Defaults to None.
integer
Random seed for reproducible samples. Defaults to None.
string | string[] | integer[]
Stop sequences, as strings or token IDs. Defaults to None.
object
Constrain generation to a structure, such as a JSON schema or regular expression. Defaults to None, which leaves generation unconstrained. See SamplingParams for the accepted format.

Next steps