Skip to content
1 min read · 271 words

Interface: ChatGenerationOptions

Defined in: src/batteries/llm/chat_common/generation.ts:33

The canonical generation options both on-device batteries accept. Every field optional + defaulted.

Properties

PropertyTypeDescriptionDefined in
enableThinking?booleanWhether to enable the model's "thinking"/reasoning mode, passed EXPLICITLY to the chat template. Default false — many reasoning templates default thinking ON and burn the budget. Already shared by both batteries under this exact name; restated here so the whole generation contract is in one place.src/batteries/llm/chat_common/generation.ts:54
maxTokens?numberMaximum tokens to GENERATE this turn. The portable spelling of transformers.js maxNewTokens / LiteRT maxOutputTokens. Default 1024.src/batteries/llm/chat_common/generation.ts:38
multimodal?{ audio?: boolean; image?: boolean; }Enable multimodal input by kind. The portable spelling of transformers.js multimodal:{image,audio} / LiteRT visionModalityEnabled+audioModalityEnabled.src/batteries/llm/chat_common/generation.ts:59
multimodal.audio?boolean-src/batteries/llm/chat_common/generation.ts:59
multimodal.image?boolean-src/batteries/llm/chat_common/generation.ts:59
sampler?ChatSamplerSampler strategy (default 'greedy' — deterministic). See ChatSampler.src/batteries/llm/chat_common/generation.ts:40
seed?numberRNG seed for reproducible sampling (best-effort; only honoured by batteries that expose it).src/batteries/llm/chat_common/generation.ts:48
temperature?numberSampling temperature, used when sampler is 'top-k'/'top-p'. Always pinned. Default 0.7.src/batteries/llm/chat_common/generation.ts:42
topK?numberTop-K cutoff, used when sampler is 'top-k'. Default 40.src/batteries/llm/chat_common/generation.ts:44
topP?numberTop-P (nucleus) cutoff, used when sampler is 'top-p'. Default 0.95.src/batteries/llm/chat_common/generation.ts:46