Class GenerationConfig.Builder
- Enclosing class:
- GenerationConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract GenerationConfig.BuilderaudioTimestamp(boolean audioTimestamp) Setter for audioTimestamp.abstract GenerationConfigbuild()abstract GenerationConfig.BuildercandidateCount(Integer candidateCount) Setter for candidateCount.abstract GenerationConfig.BuilderenableAffectiveDialog(boolean enableAffectiveDialog) Setter for enableAffectiveDialog.abstract GenerationConfig.BuilderenableEnhancedCivicAnswers(boolean enableEnhancedCivicAnswers) Setter for enableEnhancedCivicAnswers.abstract GenerationConfig.BuilderfrequencyPenalty(Float frequencyPenalty) Setter for frequencyPenalty.abstract GenerationConfig.BuilderSetter for logprobs.abstract GenerationConfig.BuildermaxOutputTokens(Integer maxOutputTokens) Setter for maxOutputTokens.abstract GenerationConfig.BuildermediaResolution(MediaResolution mediaResolution) Setter for mediaResolution.mediaResolution(MediaResolution.Known knownType) Setter for mediaResolution given a known enum.mediaResolution(String mediaResolution) Setter for mediaResolution given a string.abstract GenerationConfig.BuildermodelSelectionConfig(ModelSelectionConfig modelSelectionConfig) Setter for modelSelectionConfig.modelSelectionConfig(ModelSelectionConfig.Builder modelSelectionConfigBuilder) Setter for modelSelectionConfig builder.abstract GenerationConfig.BuilderpresencePenalty(Float presencePenalty) Setter for presencePenalty.abstract GenerationConfig.BuilderresponseJsonSchema(Object responseJsonSchema) Setter for responseJsonSchema.abstract GenerationConfig.BuilderresponseLogprobs(boolean responseLogprobs) Setter for responseLogprobs.abstract GenerationConfig.BuilderresponseMimeType(String responseMimeType) Setter for responseMimeType.responseModalities(Modality... responseModalities) Setter for responseModalities.responseModalities(Modality.Known... knownTypes) Setter for responseModalities given a varargs of known enums.responseModalities(String... responseModalities) Setter for responseModalities given a varargs of strings.abstract GenerationConfig.BuilderresponseModalities(List<Modality> responseModalities) Setter for responseModalities.responseModalitiesFromKnown(List<Modality.Known> knownTypes) Setter for responseModalities given a list of known enums.responseModalitiesFromString(List<String> responseModalities) Setter for responseModalities given a list of strings.abstract GenerationConfig.BuilderresponseSchema(Schema responseSchema) Setter for responseSchema.responseSchema(Schema.Builder responseSchemaBuilder) Setter for responseSchema builder.abstract GenerationConfig.BuilderroutingConfig(GenerationConfigRoutingConfig routingConfig) Setter for routingConfig.routingConfig(GenerationConfigRoutingConfig.Builder routingConfigBuilder) Setter for routingConfig builder.abstract GenerationConfig.BuilderSetter for seed.abstract GenerationConfig.BuilderspeechConfig(SpeechConfig speechConfig) Setter for speechConfig.speechConfig(SpeechConfig.Builder speechConfigBuilder) Setter for speechConfig builder.stopSequences(String... stopSequences) Setter for stopSequences.abstract GenerationConfig.BuilderstopSequences(List<String> stopSequences) Setter for stopSequences.abstract GenerationConfig.Buildertemperature(Float temperature) Setter for temperature.abstract GenerationConfig.BuilderthinkingConfig(ThinkingConfig thinkingConfig) Setter for thinkingConfig.thinkingConfig(ThinkingConfig.Builder thinkingConfigBuilder) Setter for thinkingConfig builder.abstract GenerationConfig.BuilderSetter for topK.abstract GenerationConfig.BuilderSetter for topP.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
modelSelectionConfig
public abstract GenerationConfig.Builder modelSelectionConfig(ModelSelectionConfig modelSelectionConfig) Setter for modelSelectionConfig.modelSelectionConfig: Optional. Config for model selection.
-
modelSelectionConfig
public GenerationConfig.Builder modelSelectionConfig(ModelSelectionConfig.Builder modelSelectionConfigBuilder) Setter for modelSelectionConfig builder.modelSelectionConfig: Optional. Config for model selection.
-
audioTimestamp
Setter for audioTimestamp.audioTimestamp: Optional. If enabled, audio timestamp will be included in the request to the model. This field is not supported in Gemini API.
-
candidateCount
Setter for candidateCount.candidateCount: Optional. Number of candidates to generate.
-
enableAffectiveDialog
Setter for enableAffectiveDialog.enableAffectiveDialog: Optional. If enabled, the model will detect emotions and adapt its responses accordingly. This field is not supported in Gemini API.
-
frequencyPenalty
Setter for frequencyPenalty.frequencyPenalty: Optional. Frequency penalties.
-
logprobs
Setter for logprobs.logprobs: Optional. Logit probabilities.
-
maxOutputTokens
Setter for maxOutputTokens.maxOutputTokens: Optional. The maximum number of output tokens to generate per message.
-
mediaResolution
Setter for mediaResolution.mediaResolution: Optional. If specified, the media resolution specified will be used.
-
mediaResolution
@CanIgnoreReturnValue public GenerationConfig.Builder mediaResolution(MediaResolution.Known knownType) Setter for mediaResolution given a known enum.mediaResolution: Optional. If specified, the media resolution specified will be used.
-
mediaResolution
Setter for mediaResolution given a string.mediaResolution: Optional. If specified, the media resolution specified will be used.
-
presencePenalty
Setter for presencePenalty.presencePenalty: Optional. Positive penalties.
-
responseJsonSchema
Setter for responseJsonSchema.responseJsonSchema: Optional. Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). 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.
-
responseLogprobs
Setter for responseLogprobs.responseLogprobs: Optional. If true, export the logprobs results in response.
-
responseMimeType
Setter for responseMimeType.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
Setter for responseModalities.responseModalities: Optional. The modalities of the response.
-
responseModalities
Setter for responseModalities.responseModalities: Optional. The modalities of the response.
-
responseModalities
@CanIgnoreReturnValue public GenerationConfig.Builder responseModalities(String... responseModalities) Setter for responseModalities given a varargs of strings.responseModalities: Optional. The modalities of the response.
-
responseModalities
@CanIgnoreReturnValue public GenerationConfig.Builder responseModalities(Modality.Known... knownTypes) Setter for responseModalities given a varargs of known enums.responseModalities: Optional. The modalities of the response.
-
responseModalitiesFromKnown
@CanIgnoreReturnValue public GenerationConfig.Builder responseModalitiesFromKnown(List<Modality.Known> knownTypes) Setter for responseModalities given a list of known enums.responseModalities: Optional. The modalities of the response.
-
responseModalitiesFromString
@CanIgnoreReturnValue public GenerationConfig.Builder responseModalitiesFromString(List<String> responseModalities) Setter for responseModalities given a list of strings.responseModalities: Optional. The modalities of the response.
-
responseSchema
Setter for responseSchema.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.
-
responseSchema
Setter for responseSchema builder.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
Setter for routingConfig.routingConfig: Optional. Routing configuration. This field is not supported in Gemini API.
-
routingConfig
public GenerationConfig.Builder routingConfig(GenerationConfigRoutingConfig.Builder routingConfigBuilder) Setter for routingConfig builder.routingConfig: Optional. Routing configuration. This field is not supported in Gemini API.
-
seed
Setter for seed.seed: Optional. Seed.
-
speechConfig
Setter for speechConfig.speechConfig: Optional. The speech generation config.
-
speechConfig
Setter for speechConfig builder.speechConfig: Optional. The speech generation config.
-
stopSequences
Setter for stopSequences.stopSequences: Optional. Stop sequences.
-
stopSequences
Setter for stopSequences.stopSequences: Optional. Stop sequences.
-
temperature
Setter for temperature.temperature: Optional. Controls the randomness of predictions.
-
thinkingConfig
Setter for thinkingConfig.thinkingConfig: Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
-
thinkingConfig
Setter for thinkingConfig builder.thinkingConfig: Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking.
-
topK
Setter for topK.topK: Optional. If specified, top-k sampling will be used.
-
topP
Setter for topP.topP: Optional. If specified, nucleus sampling will be used.
-
enableEnhancedCivicAnswers
public abstract GenerationConfig.Builder enableEnhancedCivicAnswers(boolean enableEnhancedCivicAnswers) Setter for enableEnhancedCivicAnswers.enableEnhancedCivicAnswers: Optional. Enables enhanced civic answers. It may not be available for all models. This field is not supported in Vertex AI.
-
build
-