GenerationConfigKt

public final classGenerationConfigKt


Summary

Public methods

static final @NonNullGenerationConfig

Helper method to construct aGenerationConfig in a DSL-like manner.

Public methods

generationConfig

public static final @NonNullGenerationConfig generationConfig(
    @ExtensionFunctionType @NonNull Function1<@NonNullGenerationConfig.BuilderUnit> init
)

Helper method to construct aGenerationConfig in a DSL-like manner.

Example Usage:

generationConfig {
temperature = 0.75f
topP = 0.5f
topK = 30
candidateCount = 4
maxOutputTokens = 300
stopSequences = listOf("in conclusion", "-----", "do you need")
}

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.