Class GeminiGenerationConfiguration
- Namespace
- Uralstech.UGemini.Models.Generation
Configuration options for model generation and outputs. Not all parameters may be configurable for every model.
public class GeminiGenerationConfiguration
- Inheritance
-
GeminiGenerationConfiguration
- Extension Methods
Fields
CandidateCount
Number of generated responses to return.
public int CandidateCount
Field Value
Remarks
Currently, this value can only be set to 1. If unset, this will default to 1.
FrequencyPenalty
Frequency penalty applied to the next token's logprobs, multiplied by the number of times each token has been seen in the response so far.
public float FrequencyPenalty
Field Value
Remarks
A positive penalty will discourage the use of tokens that have already been used, proportional to the number
of times the token has been used: The more a token is used, the more dificult it is for the model to use that
token again increasing the vocabulary of responses.
Caution: A negative penalty will encourage the model to reuse tokens proportional to the number of times the
token has been used. Small negative values will reduce the vocabulary of a response. Larger negative values
will cause the model to start repeating a common token until it hits the
MaxOutputTokens limit: "...the the the the the...".
Logprobs
Only valid if ResponseLogprobs = true. This sets the number of top logprobs to return at each decoding step in the LogprobsResult.
public int Logprobs
Field Value
MaxOutputTokens
The maximum number of tokens to include in a candidate.
public int MaxOutputTokens
Field Value
PresencePenalty
Presence penalty applied to the next token's logprobs if the token has already been seen in the response.
public float PresencePenalty
Field Value
Remarks
This penalty is binary on/off and not dependant on the number of times the token is used (after the first). Use
FrequencyPenalty for a penalty that increases with each use. A positive penalty will
discourage the use of tokens that have already been used in the response, increasing the vocabulary. A negative
penalty will encourage the use of tokens that have already been used in the response, decreasing the vocabulary.
ResponseLogprobs
If true, export the logprobs results in response.
public bool? ResponseLogprobs
Field Value
- bool?
ResponseMimeType
Output response type of the generated candidate text.
public GeminiResponseType ResponseMimeType
Field Value
Remarks
Only available in the beta API.
ResponseSchema
Output response schema of the generated candidate text when response mime type can have schema.
public GeminiSchema ResponseSchema
Field Value
Remarks
If set, a compatible GeminiResponseType must also be set. Compatible types: Json: Schema for JSON response.
Only available in the beta API.
StopSequences
The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response.
public string[] StopSequences
Field Value
- string[]
Temperature
Controls the randomness of the output. Values can range from 0.0 - 2.0.
public float Temperature
Field Value
TopK
The maximum number of tokens to consider when sampling.
public int TopK
Field Value
Remarks
Models use nucleus sampling or combined 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.
TopP
The maximum cumulative probability of tokens to consider when sampling.
public float TopP
Field Value
Remarks
The model uses combined Top-k and nucleus sampling.
Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered.
Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits
number of tokens based on the cumulative probability.