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 toresponse_schemathat accepts JSON Schema. If set,response_schemamust be omitted, butresponse_mime_typeis 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 asanyOf) -properties-additionalProperties-requiredThe non-standardpropertyOrderingproperty 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$refis 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 theModel.output_token_limitattribute of theModelreturned from thegetModelfunction.: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. UseresponseJsonSchemarather 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 ofbinary/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 compatibleresponse_mime_typemust 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 ofbinary/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 astop_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 theModel.temperatureattribute of theModelreturned from thegetModelfunction. 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 oftop_kmost probable tokens. Models running with nucleus sampling don't allow top_k setting. Note: The default value varies byModeland is specified by theModel.top_pattribute returned from thegetModelfunction. An emptytop_kattribute indicates that the model doesn't apply top-k sampling and doesn't allow settingtop_kon 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 byModeland is specified by theModel.top_pattribute returned from thegetModelfunction. An emptytop_kattribute indicates that the model doesn't apply top-k sampling and doesn't allow settingtop_kon requests.
Summary
Functions
Create a Geminix.V1beta.GenerationConfig.t/0 from a map returned
by the Gemini API.
Types
@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
@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.