Geminix.V1beta.GenerationConfig (geminix v0.2.0)

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

Fields:

  • :_response_json_schema (any/0) - Optional. Output schema of the generated response. This is an alternative to response_schema that accepts JSON Schema. If set, response_schema must be omitted, but response_mime_type is required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: - $id - $defs - $ref - $anchor - type - format - title - description - enum (for strings and numbers) - items - prefixItems - minItems - maxItems - minimum - maximum - anyOf - oneOf (interpreted the same as anyOf) - properties - additionalProperties - required The non-standard propertyOrdering property may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If $ref is set on a sub-schema, no other properties, except for than those starting as a $, may be set.
  • :candidate_count (integer/0) - Optional. Number of generated responses to return. If unset, this will default to 1. Please note that this doesn't work for previous generation models (Gemini 1.0 family)
  • :enable_enhanced_civic_answers (boolean/0) - Optional. Enables enhanced civic answers. It may not be available for all models.
  • :frequency_penalty (number/0) - Optional. Frequency penalty applied to the next token's logprobs, multiplied by the number of times each token has been seen in the respponse 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 max_output_tokens limit.
  • :image_config (Geminix.V1beta.ImageConfig.t/0) - Optional. Config for image generation. An error will be returned if this field is set for models that don't support these config options.
  • :logprobs (integer/0) - Optional. Only valid if response_logprobs=True. This sets the number of top logprobs to return at each decoding step in the Candidate.logprobs_result. The number must be in the range of [0, 20].
  • :max_output_tokens (integer/0) - Optional. The maximum number of tokens to include in a response candidate. Note: The default value varies by model, see the Model.output_token_limit attribute of the Model returned from the getModel function.
  • :media_resolution (binary/0) - Optional. If specified, the media resolution specified will be used.
  • :presence_penalty (number/0) - 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 frequency_penalty 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.
  • :response_json_schema (any/0) - Optional. An internal detail. Use responseJsonSchema rather than this field.
  • :response_logprobs (boolean/0) - Optional. If true, export the logprobs results in response.
  • :response_mime_type (binary/0) - 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.
  • :response_modalities (list of binary/0) - Optional. The requested modalities of the response. Represents the set of modalities that the model can return, and should be expected in the response. This is an exact match to the modalities of the response. A model may have multiple combinations of supported modalities. If the requested modalities do not match any of the supported combinations, an error will be returned. An empty list is equivalent to requesting only text.
  • :response_schema (Geminix.V1beta.Schema.t/0) - 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 response_mime_type must also be set. Compatible MIME types: application/json: Schema for JSON response. Refer to the JSON text generation guide for more details.
  • :seed (integer/0) - Optional. Seed used in decoding. If not set, the request uses a randomly generated seed.
  • :speech_config (Geminix.V1beta.SpeechConfig.t/0) - Optional. The speech generation config.
  • :stop_sequences (list of binary/0) - 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.
  • :temperature (number/0) - 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].
  • :thinking_config (Geminix.V1beta.ThinkingConfig.t/0) - Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
  • :top_k (integer/0) - 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 top_k most probable tokens. Models running with nucleus sampling don't allow top_k setting. Note: The default value varies by Model and is specified by theModel.top_p attribute returned from the getModel function. An empty top_k attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting top_k on requests.
  • :top_p (number/0) - Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and Top-p (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 the number of tokens based on the cumulative probability. Note: The default value varies by Model and is specified by theModel.top_p attribute returned from the getModel function. An empty top_k attribute indicates that the model doesn't apply top-k sampling and doesn't allow setting top_k on requests.

Summary

Types

t()

@type t() :: %Geminix.V1beta.GenerationConfig{
  __meta__: term(),
  _response_json_schema: any(),
  candidate_count: integer(),
  enable_enhanced_civic_answers: boolean(),
  frequency_penalty: number(),
  image_config: Geminix.V1beta.ImageConfig.t(),
  logprobs: integer(),
  max_output_tokens: integer(),
  media_resolution: binary(),
  presence_penalty: number(),
  response_json_schema: any(),
  response_logprobs: boolean(),
  response_mime_type: binary(),
  response_modalities: [binary()],
  response_schema: Geminix.V1beta.Schema.t(),
  seed: integer(),
  speech_config: Geminix.V1beta.SpeechConfig.t(),
  stop_sequences: [binary()],
  temperature: number(),
  thinking_config: Geminix.V1beta.ThinkingConfig.t(),
  top_k: integer(),
  top_p: number()
}

Functions

from_map(schema \\ %__MODULE__{}, map)

@spec from_map(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Create a Geminix.V1beta.GenerationConfig.t/0 from a map returned by the Gemini API.

Sometimes, this function should not be applied to the full response body, but instead it should be applied to the correct part of the map in the response body. This depends on the concrete API call.