ModelOptions

data class ModelOptions(val numCtx: Int = 4096, val repeatLastN: Int? = null, val repeatPenalty: Double? = null, val temperature: Double? = null, val seed: Int? = null, val stop: List<String>? = null, val numPredict: Int? = null, val topK: Int? = null, val topP: Double? = null, val minP: Double? = null)(source)

Configuration options for model text generation behavior.

These parameters control aspects such as repetition penalties, randomness, prediction limits, and stopping criteria for language model output generation.

See Valid Parameters and Values

Constructors

Link copied to clipboard
constructor(numCtx: Int = 4096, repeatLastN: Int? = null, repeatPenalty: Double? = null, temperature: Double? = null, seed: Int? = null, stop: List<String>? = null, numPredict: Int? = null, topK: Int? = null, topP: Double? = null, minP: Double? = null)

Properties

Link copied to clipboard
@SerialName(value = "min_p")
val minP: Double?

Minimum probability ratio for a token to be considered. Filters out tokens whose probability is too small relative to the most likely token. Default: 0.0

Link copied to clipboard
@SerialName(value = "num_ctx")
val numCtx: Int

The size of the context window used to generate the next token. Default: 4096

Link copied to clipboard
@SerialName(value = "num_predict")
val numPredict: Int?

Maximum number of tokens to generate. -1 means unlimited (until a stop condition is met). Default: -1

Link copied to clipboard
@SerialName(value = "repeat_last_n")
val repeatLastN: Int?

How far back the model looks to prevent repetition. Default: 64. Set to 0 to disable, or -1 to use the full context window.

Link copied to clipboard
@SerialName(value = "repeat_penalty")
val repeatPenalty: Double?

Strength of repetition penalty. Higher values (e.g., 1.5) penalize repeated tokens more strongly. Default: 1.1

Link copied to clipboard
val seed: Int?

Random seed for reproducibility. Using the same seed and prompt produces the same output. Default: 0

Link copied to clipboard
@Serializable(with = StringOrListSerializer::class)
val stop: List<String>?

Stop sequence(s) that end generation when encountered. If null, no stop condition is applied. Example: "AI assistant:"

Link copied to clipboard

Sampling temperature for generation. Higher values increase randomness; lower values make output more deterministic. Default: 0.8

Link copied to clipboard
@SerialName(value = "top_k")
val topK: Int?

Limits token sampling to the top K most likely tokens. Higher values increase output diversity. Default: 40

Link copied to clipboard
@SerialName(value = "top_p")
val topP: Double?

Top-p (nucleus) sampling parameter. Tokens are sampled from the smallest set whose cumulative probability exceeds top_p. Default: 0.9