Search Results for

    Show / Hide Table of Contents

    Class GeminiConfig

    Configuration options for model generation and outputs. Not all parameters may be configurable for every model.

    Note: Formerly known as "GenerationConfig" to match the official Gemini API. But renamed to "GeminiConfig" to avoid confusion with other similar classes for other providers.

    2025-03-30: Added new properties - responseMimeType, responseSchema, responseModalities 2025-09-24: Added new properties - thinkingConfig 2025-12-17: Added imageConfig

    Inheritance
    object
    GeminiConfig
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Google
    Assembly: Glitch9.AIDevKit.Provider.Google.dll
    Syntax
    public class GeminiConfig

    Properties

    | Edit this page View Source

    CandidateCount

    Optional. Number of generated responses to return. Currently, this value can only be set to 1. If unset, this will default to 1.

    Declaration
    [JsonProperty("candidateCount")]
    public int CandidateCount { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    EnableEnhancedCivicAnswers

    Optional. Enables enhanced civic answers. It may not be available for all models.

    Declaration
    [JsonProperty("enableEnhancedCivicAnswers")]
    public bool? EnableEnhancedCivicAnswers { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    FrequencyPenalty

    Optional. 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. 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 difficult 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.

    Declaration
    [JsonProperty("frequencyPenalty")]
    public float? FrequencyPenalty { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    ImageConfig

    Optional. Config for image generation. An error will be returned if this field is set for models that don't support these config options.

    Declaration
    [JsonProperty("imageConfig")]
    public ImageConfig ImageConfig { get; set; }
    Property Value
    Type Description
    ImageConfig
    | Edit this page View Source

    Logprobs

    Optional. Only valid if responseLogprobs=True. This sets the number of top logprobs to return at each decoding step in the Candidate.logprobs_result.

    Declaration
    [JsonProperty("logprobs")]
    public int? Logprobs { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    MaxTokens

    Optional. The maximum number of tokens to include in a candidate. Note: The default value varies by model, see the Model.output_token_limit attribute of the Model returned from the getModel function.

    Declaration
    [JsonProperty("maxOutputTokens")]
    public int? MaxTokens { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    MediaResolution

    Optional. If specified, the media resolution specified will be used.

    Declaration
    [JsonProperty("mediaResolution")]
    public MediaResolution? MediaResolution { get; set; }
    Property Value
    Type Description
    MediaResolution?
    | Edit this page View Source

    PresencePenalty

    Optional. Presence penalty applied to the next token's logprobs if the token has already been seen in the response. 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.

    Declaration
    [JsonProperty("presencePenalty")]
    public float? PresencePenalty { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    ResponseLogprobs

    Optional. If true, export the logprobs results in response.

    Declaration
    [JsonProperty("responseLogprobs")]
    public bool? ResponseLogprobs { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    ResponseMimeType

    Optional. MIME type of the generated candidate text. Supported MIME types are:

    • text/plain: (default) Text output.
    • application/json: JSON response in the response candidates.
    • text/x.enum: ENUM as a string response in the response candidates. Refer to the docs for a list of all supported text MIME types. Refer to the docs for a list of all supported text MIME types.
    Declaration
    [JsonProperty("responseMimeType")]
    public string ResponseMimeType { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    ResponseModalities

    Optional. The requested Modality of the response. Represents the set of Modality that the model can return, and should be expected in the response. This is an exact match to the Modality of the response. A model may have multiple combinations of supported Modality. If the requested Modality do not match any of the supported combinations, an error will be returned. An empty list is equivalent to requesting only text.

    Declaration
    [JsonProperty("responseModalities")]
    public List<Modality> ResponseModalities { get; set; }
    Property Value
    Type Description
    List<Modality>
    | Edit this page View Source

    ResponseSchema

    Optional. Output schema of the generated candidate text. Schemas must be a subset of the OpenAPI schema and can be objects, primitives or arrays. If set, a compatible responseMimeType must also be set. Compatible MIME types: application/json: Schema for JSON response. Refer to the JSON text generation guide for more details.

    Declaration
    [JsonProperty("responseSchema")]
    public JsonSchema ResponseSchema { get; set; }
    Property Value
    Type Description
    JsonSchema
    | Edit this page View Source

    Seed

    Optional. Seed used in decoding. If not set, the request uses a randomly generated seed.

    Declaration
    [JsonProperty("seed")]
    public int? Seed { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    SpeechConfig

    Optional. The speech generation config.

    Declaration
    [JsonProperty("speechConfig")]
    public SpeechConfig SpeechConfig { get; set; }
    Property Value
    Type Description
    SpeechConfig
    | Edit this page View Source

    StopSequences

    Optional. 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.

    Declaration
    [JsonProperty("stopSequences")]
    public string[] StopSequences { get; set; }
    Property Value
    Type Description
    string[]
    | Edit this page View Source

    Temperature

    Optional. Controls the randomness of the output. Note: The default value varies by model, see the Model.temperature attribute of the Model returned from the getModel function. Values can range from [0.0, 2.0].

    Declaration
    [JsonProperty("temperature")]
    public float? Temperature { get; set; }
    Property Value
    Type Description
    float?
    | Edit this page View Source

    ThinkingConfig

    Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.

    Declaration
    [JsonProperty("thinkingConfig")]
    public ThinkingConfig ThinkingConfig { get; set; }
    Property Value
    Type Description
    ThinkingConfig
    | Edit this page View Source

    TopK

    Optional. The maximum number of tokens to consider when sampling. 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. Note: The default value varies by model, see the Model.top_k attribute of the Model returned from the getModel function. Empty topK field in Model indicates the model doesn't apply top-k sampling and doesn't allow setting topK on requests.

    Declaration
    [JsonProperty("topK")]
    public int? TopK { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    TopP

    Optional. The maximum cumulative probability of tokens to consider when sampling. 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. Note: The default value varies by model, see the Model.top_p attribute of the Model returned from the getModel function.

    Declaration
    [JsonProperty("topP")]
    public float? TopP { get; set; }
    Property Value
    Type Description
    float?

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation