GenerationConfigTopK Property

Optional. The maximum number of tokens to consider when sampling. Gemini models use Top-p (nucleus) sampling or a combination of Top-k and nucleus sampling. Top-k sampling considers the set of TopK most probable tokens. Models running with nucleus sampling don't allow TopK setting. Note: The default value varies by Model and is specified by the TopP attribute returned from the [!:getModel] function. An empty TopK attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting TopK on requests.

Definition

Namespace: GenerativeAI.Types
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public int? TopK { get; set; }

Property Value

NullableInt32

See Also