GenerationConfig

@Serializable
data class GenerationConfig(val stopSequences: List<String>, val temperature: Double, val maxOutputTokens: Int, val topP: Double, val topK: Int, val responseMimeType: String? = null)

Configures the parameters for content generation, including conditions for stopping generation, creativity controls, output limits, and the format of the generated content.

Constructors

Link copied to clipboard
constructor(stopSequences: List<String>, temperature: Double, maxOutputTokens: Int, topP: Double, topK: Int, responseMimeType: String? = null)

Properties

Link copied to clipboard

An integer specifying the maximum number of tokens that can be generated. This serves as a hard limit on the size of the generated content.

Link copied to clipboard
@SerialName(value = "response_mime_type")
val responseMimeType: String? = null

An optional string specifying the MIME type of the response. This is particularly relevant for specialized applications like Gemini 1.5 pro, where "application/json" might be required. It is nullable to accommodate different or default response formats.

Link copied to clipboard
val stopSequences: List<String>

A list of strings that, when generated, will signal the model to stop generating further content. This can be used to define natural endpoints or boundaries for generated content.

Link copied to clipboard
val temperature: Double

A double value controlling the randomness of the generation. Higher values increase creativity and diversity, while lower values make the output more deterministic.

Link copied to clipboard
val topK: Int

An integer that limits the model to consider only the top-k most likely next tokens for each step of generation, enhancing control over the randomness and relevance of the output.

Link copied to clipboard
val topP: Double

A double value for nucleus sampling, a stochastic decoding method that focuses generation on the most likely next tokens with cumulative probability above this threshold.