mstar.utils.generation_kwargs

mstar.utils.generation_kwargs#

The client-facing generation knobs, checked once where every endpoint submits.

One meaning per knob on every model: null is the same as leaving the key out, types are strict (no "0.7"), and a value out of range is a ValueError (a 400) before any worker sees the request. A multi-stage model’s <stage>_<knob> (talker_temperature) follows the rule for <knob>.

Functions

check_seed(seed)

Raise ValueError unless seed is None or an integer that fits in int64.

normalize_generation_kwargs(model_kwargs)

model_kwargs with nulls dropped, length aliases folded into max_output_tokens, and every known knob type- and range-checked.

mstar.utils.generation_kwargs.check_seed(seed)[source]#

Raise ValueError unless seed is None or an integer that fits in int64.

int64 is the widest seed a sampler can store or pass to manual_seed, and past it the request cannot even be packed for the conductor.

Return type:

None

mstar.utils.generation_kwargs.normalize_generation_kwargs(model_kwargs)[source]#

model_kwargs with nulls dropped, length aliases folded into max_output_tokens, and every known knob type- and range-checked.

Raises ValueError naming the knob and its allowed range.

Parameters:

model_kwargs (dict | None)

Return type:

dict