---
title: "GenerationConfig"
sidebar_label: "GenerationConfig"
description: "Kotlin binding reference: GenerationConfig."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.modelverse](../index.md)/[GenerationConfig](index.md)

# GenerationConfig

[common]\
data class [GenerationConfig](index.md)(val maxTokens: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, val temperature: [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 0.0f, val topK: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, val topP: [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 1.0f, val repetitionPenalty: [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 1.0f, val thinking: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null, val noRepeatNgramSize: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, val noRepeatNgramWindow: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0)

The decode policy of one request. A zero [maxTokens](maxTokens.md) or [topK](topK.md) keeps the model's own default for that knob ([Capabilities.defaults](../Capabilities/defaults.md)); [temperature](temperature.md) and [topP](topP.md) apply as given, so a caller that wants the model's defaults for them copies them from [Capabilities.defaults](../Capabilities/defaults.md).

## Constructors

| | |
|---|---|
| [GenerationConfig](GenerationConfig.md) | [common]<br>constructor(maxTokens: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, temperature: [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 0.0f, topK: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, topP: [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 1.0f, repetitionPenalty: [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 1.0f, thinking: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null, noRepeatNgramSize: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0, noRepeatNgramWindow: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0) |

## Properties

| Name | Summary |
|---|---|
| [maxTokens](maxTokens.md) | [common]<br>val [maxTokens](maxTokens.md): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0<br>The most new tokens the reply may hold; 0 keeps the model's default budget. |
| [noRepeatNgramSize](noRepeatNgramSize.md) | [common]<br>val [noRepeatNgramSize](noRepeatNgramSize.md): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0<br>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](../Capabilities/supportsRepetitionKnobs.md)). |
| [noRepeatNgramWindow](noRepeatNgramWindow.md) | [common]<br>val [noRepeatNgramWindow](noRepeatNgramWindow.md): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0<br>The trailing tokens the n-gram rule searches; 0 searches the whole sequence. |
| [repetitionPenalty](repetitionPenalty.md) | [common]<br>val [repetitionPenalty](repetitionPenalty.md): [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 1.0f<br>The repetition penalty; 1 applies none, and it must be above 0. A library without the knob ([Capabilities.supportsRepetitionKnobs](../Capabilities/supportsRepetitionKnobs.md) false) refuses any other value, and the request ends in [GenerationListener.onError](../GenerationListener/onError.md). |
| [temperature](temperature.md) | [common]<br>val [temperature](temperature.md): [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 0.0f<br>The sampling temperature; 0 decodes greedily. |
| [thinking](thinking.md) | [common]<br>val [thinking](thinking.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null<br>The thinking channel for this request on a model whose [Capabilities.thinking](../Capabilities/thinking.md) is [ThinkingControl.TOGGLE](../ThinkingControl/TOGGLE/index.md): `true` on, `false` off, `null` the model's default ([LoadOptions.thinking](../LoadOptions/thinking.md) when set). Every other control ignores it. |
| [topK](topK.md) | [common]<br>val [topK](topK.md): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0<br>Keep the k most likely candidates; 0 keeps the model's default. |
| [topP](topP.md) | [common]<br>val [topP](topP.md): [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) = 1.0f<br>Keep the smallest candidate set whose probability reaches this; 1 keeps every candidate. |