Package com.google.genai.types
Class GenerationConfig
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.GenerationConfig
Generation config.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for GenerationConfig. -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOptional.static GenerationConfig.Builderbuilder()Instantiates a builder for GenerationConfig.Optional.Optional.Optional.Optional.static GenerationConfigDeserializes a JSON string to a GenerationConfig object.logprobs()Optional.Optional.abstract Optional<MediaResolution>Optional.abstract Optional<ModelSelectionConfig>Optional.Optional.Output schema of the generated response.Optional.Optional.Optional.Optional.abstract Optional<GenerationConfigRoutingConfig>Optional.seed()Optional.abstract Optional<SpeechConfig>Optional.Optional.Optional.abstract Optional<ThinkingConfig>Optional.abstract GenerationConfig.BuilderCreates a builder with the same values as this instance.topK()Optional.topP()Optional.Methods inherited from class com.google.genai.JsonSerializable
setMaxReadLength, stringToJsonNode, toJson
-
Constructor Details
-
GenerationConfig
public GenerationConfig()
-
-
Method Details
-
modelSelectionConfig
Optional. Config for model selection. -
responseJsonSchema
Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). -
audioTimestamp
Optional. If enabled, audio timestamp will be included in the request to the model. This field is not supported in Gemini API. -
candidateCount
Optional. Number of candidates to generate. -
enableAffectiveDialog
Optional. If enabled, the model will detect emotions and adapt its responses accordingly. This field is not supported in Gemini API. -
frequencyPenalty
Optional. Frequency penalties. -
logprobs
Optional. Logit probabilities. -
maxOutputTokens
Optional. The maximum number of output tokens to generate per message. -
mediaResolution
Optional. If specified, the media resolution specified will be used. -
presencePenalty
Optional. Positive penalties. -
responseLogprobs
Optional. If true, export the logprobs results in response. -
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. -
responseModalities
Optional. The modalities of the response. -
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
Optional. Routing configuration. This field is not supported in Gemini API. -
seed
Optional. Seed. -
speechConfig
Optional. The speech generation config. -
stopSequences
Optional. Stop sequences. -
temperature
Optional. Controls the randomness of predictions. -
thinkingConfig
Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking. -
topK
Optional. If specified, top-k sampling will be used. -
topP
Optional. If specified, nucleus sampling will be used. -
enableEnhancedCivicAnswers
Optional. Enables enhanced civic answers. It may not be available for all models. This field is not supported in Vertex AI. -
builder
Instantiates a builder for GenerationConfig. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a GenerationConfig object.
-