Class GenerationConfig

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.GenerationConfig

public abstract class GenerationConfig extends JsonSerializable
Generation config.
  • Constructor Details

    • GenerationConfig

      public GenerationConfig()
  • Method Details

    • audioTimestamp

      public abstract Optional<Boolean> audioTimestamp()
      Optional. If enabled, audio timestamp will be included in the request to the model.
    • candidateCount

      public abstract Optional<Integer> candidateCount()
      Optional. Number of candidates to generate.
    • frequencyPenalty

      public abstract Optional<Float> frequencyPenalty()
      Optional. Frequency penalties.
    • logprobs

      public abstract Optional<Integer> logprobs()
      Optional. Logit probabilities.
    • maxOutputTokens

      public abstract Optional<Integer> maxOutputTokens()
      Optional. The maximum number of output tokens to generate per message.
    • presencePenalty

      public abstract Optional<Float> presencePenalty()
      Optional. Positive penalties.
    • responseLogprobs

      public abstract Optional<Boolean> responseLogprobs()
      Optional. If true, export the logprobs results in response.
    • responseMimeType

      public abstract Optional<String> responseMimeType()
      Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.
    • responseSchema

      public abstract Optional<Schema> responseSchema()
      Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response.
    • routingConfig

      public abstract Optional<GenerationConfigRoutingConfig> routingConfig()
      Optional. Routing configuration.
    • seed

      public abstract Optional<Integer> seed()
      Optional. Seed.
    • stopSequences

      public abstract Optional<List<String>> stopSequences()
      Optional. Stop sequences.
    • temperature

      public abstract Optional<Float> temperature()
      Optional. Controls the randomness of predictions.
    • topK

      public abstract Optional<Float> topK()
      Optional. If specified, top-k sampling will be used.
    • topP

      public abstract Optional<Float> topP()
      Optional. If specified, nucleus sampling will be used.
    • builder

      public static GenerationConfig.Builder builder()
      Instantiates a builder for GenerationConfig.
    • toBuilder

      public abstract GenerationConfig.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static GenerationConfig fromJson(String jsonString)
      Deserializes a JSON string to a GenerationConfig object.