GenerationConfig

@Serializable
data class GenerationConfig(val stopSequences: Array<String>? = null, val temperature: Double? = null, val maxOutputTokens: Int? = null, val topP: Double? = null, val topK: Int? = null, val responseMimeType: String? = null, val responseModalities: Array<Modality>? = null, val thinkingConfig: ThinkingConfig? = null, val imageConfig: ImageConfig? = null, val speechConfig: SpeechConfig? = 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: Array<String>? = null, temperature: Double? = null, maxOutputTokens: Int? = null, topP: Double? = null, topK: Int? = null, responseMimeType: String? = null, responseModalities: Array<Modality>? = null, thinkingConfig: ThinkingConfig? = null, imageConfig: ImageConfig? = null, speechConfig: SpeechConfig? = null)

Properties

Link copied to clipboard
Link copied to clipboard
val maxOutputTokens: Int?

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

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

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
@SerialName(value = "response_modalities")
val responseModalities: Array<Modality>?
Link copied to clipboard
Link copied to clipboard
val stopSequences: Array<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
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.