Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Llama.InitSampler

Initializes the sampler chain.

Component Version macOS Windows Linux Server iOS SDK
Llama 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Llama.InitSampler"; LlamaSession; Configuration )   More

Parameters

Parameter Description Example
LlamaSession The session identifier. $$session
Configuration The JSON array with the sampler objects.

Result

Returns OK or error.

Description

Initializes the sampler chain.
Please pass a JSON array with objects. Each object has an entry "sampler" naming one of the samplers to use.

greedy

dist
seed: optional parameter with seed.

top_k
k

top_p
p: e.g. 0.8
min_keep: e.g. 1

min_p
p: e.g. 0.8
min_keep: e.g. 1

typical
p: e.g. 0.8
min_keep: e.g. 1

temp
t: e.g. 0.8

temp_ext
t:
delta:
exponent:

top_n_sigma
t:

xtc
p:
t:
min_keep
seed:

mirostat
n_vocab:
seed: optional
tau:
eta:

mirostat_v2
seed: optional
tau:
eta:

Examples

Init the sampler:

Set Variable [ $r ; Value: MBS(
    "Llama.InitSampler" ;
    $$session ;
    JSONSetElement(
        "[]" ;
        [ "[+].sampler" ; "min_p" ; JSONString ] ;
        [ "[:].p" ; ,8 ; JSONNumber ] ;
        [ "[:].min_keep" ; 1 ; JSONNumber ] ;
        [ "[+].sampler" ; "temp" ; JSONString ] ;
        [ "[:].t" ; ,8 ; JSONNumber ] ;
        [ "[+].sampler" ; "dist" ; JSONString ])
)]

See also

Example Databases

Blog Entries

Created 10th February 2026, last changed 25th February 2026


Llama.Detokenize - Llama.List