//clika-runtime/io.clika.modelverse/GenerationConfig
GenerationConfig
[common]
data class GenerationConfig(val maxTokens: Int = 0, val temperature: Float = 0.0f, val topK: Int = 0, val topP: Float = 1.0f, val repetitionPenalty: Float = 1.0f, val thinking: Boolean? = null, val noRepeatNgramSize: Int = 0, val noRepeatNgramWindow: Int = 0)
The decode policy of one request. A zero maxTokens or topK keeps the model's own default for that knob (Capabilities.defaults); temperature and topP apply as given, so a caller that wants the model's defaults for them copies them from Capabilities.defaults.
Constructors
| GenerationConfig | [common] constructor(maxTokens: Int = 0, temperature: Float = 0.0f, topK: Int = 0, topP: Float = 1.0f, repetitionPenalty: Float = 1.0f, thinking: Boolean? = null, noRepeatNgramSize: Int = 0, noRepeatNgramWindow: Int = 0) |
Properties
| Name | Summary |
|---|---|
| maxTokens | [common] val maxTokens: Int = 0 The most new tokens the reply may hold; 0 keeps the model's default budget. |
| noRepeatNgramSize | [common] val noRepeatNgramSize: Int = 0 The no-repeat n-gram rule: no n-gram of this many tokens may appear twice in the reply (the prompt counted); 0 leaves the rule off. A library without the knob refuses a positive value (Capabilities.supportsRepetitionKnobs). |
| noRepeatNgramWindow | [common] val noRepeatNgramWindow: Int = 0 The trailing tokens the n-gram rule searches; 0 searches the whole sequence. |
| repetitionPenalty | [common] val repetitionPenalty: Float = 1.0f The repetition penalty; 1 applies none, and it must be above 0. A library without the knob (Capabilities.supportsRepetitionKnobs false) refuses any other value, and the request ends in GenerationListener.onError. |
| temperature | [common] val temperature: Float = 0.0f The sampling temperature; 0 decodes greedily. |
| thinking | [common] val thinking: Boolean? = null The thinking channel for this request on a model whose Capabilities.thinking is ThinkingControl.TOGGLE: true on, false off, null the model's default (LoadOptions.thinking when set). Every other control ignores it. |
| topK | [common] val topK: Int = 0 Keep the k most likely candidates; 0 keeps the model's default. |
| topP | [common] val topP: Float = 1.0f Keep the smallest candidate set whose probability reaches this; 1 keeps every candidate. |