Class GenerateContentConfig.Builder
- Enclosing class:
- GenerateContentConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract GenerateContentConfig.BuilderaudioTimestamp(boolean audioTimestamp) Setter for audioTimestamp.abstract GenerateContentConfig.BuilderautomaticFunctionCalling(AutomaticFunctionCallingConfig automaticFunctionCalling) Setter for automaticFunctionCalling.automaticFunctionCalling(AutomaticFunctionCallingConfig.Builder automaticFunctionCallingBuilder) Setter for automaticFunctionCalling builder.abstract GenerateContentConfigbuild()abstract GenerateContentConfig.BuildercachedContent(String cachedContent) Setter for cachedContent.abstract GenerateContentConfig.BuildercandidateCount(Integer candidateCount) Setter for candidateCount.Clears the value of audioTimestamp field.Clears the value of automaticFunctionCalling field.Clears the value of cachedContent field.Clears the value of candidateCount field.Clears the value of frequencyPenalty field.Clears the value of httpOptions field.Clears the value of imageConfig field.Clears the value of labels field.Clears the value of logprobs field.Clears the value of maxOutputTokens field.Clears the value of mediaResolution field.Clears the value of modelSelectionConfig field.Clears the value of presencePenalty field.Clears the value of responseJsonSchema field.Clears the value of responseLogprobs field.Clears the value of responseMimeType field.Clears the value of responseModalities field.Clears the value of responseSchema field.Clears the value of routingConfig field.Clears the value of safetySettings field.Clears the value of seed field.Clears the value of shouldReturnHttpResponse field.Clears the value of speechConfig field.Clears the value of stopSequences field.Clears the value of systemInstruction field.Clears the value of temperature field.Clears the value of thinkingConfig field.Clears the value of toolConfig field.Clears the value of tools field.Clears the value of topK field.Clears the value of topP field.abstract GenerateContentConfig.BuilderfrequencyPenalty(Float frequencyPenalty) Setter for frequencyPenalty.abstract GenerateContentConfig.BuilderhttpOptions(HttpOptions httpOptions) Setter for httpOptions.httpOptions(HttpOptions.Builder httpOptionsBuilder) Setter for httpOptions builder.abstract GenerateContentConfig.BuilderimageConfig(ImageConfig imageConfig) Setter for imageConfig.imageConfig(ImageConfig.Builder imageConfigBuilder) Setter for imageConfig builder.abstract GenerateContentConfig.BuilderSetter for labels.abstract GenerateContentConfig.BuilderSetter for logprobs.abstract GenerateContentConfig.BuildermaxOutputTokens(Integer maxOutputTokens) Setter for maxOutputTokens.abstract GenerateContentConfig.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 GenerateContentConfig.BuildermodelSelectionConfig(ModelSelectionConfig modelSelectionConfig) Setter for modelSelectionConfig.modelSelectionConfig(ModelSelectionConfig.Builder modelSelectionConfigBuilder) Setter for modelSelectionConfig builder.abstract GenerateContentConfig.BuilderpresencePenalty(Float presencePenalty) Setter for presencePenalty.abstract GenerateContentConfig.BuilderresponseJsonSchema(Object responseJsonSchema) Setter for responseJsonSchema.abstract GenerateContentConfig.BuilderresponseLogprobs(boolean responseLogprobs) Setter for responseLogprobs.abstract GenerateContentConfig.BuilderresponseMimeType(String responseMimeType) Setter for responseMimeType.responseModalities(String... responseModalities) Setter for responseModalities.abstract GenerateContentConfig.BuilderresponseModalities(List<String> responseModalities) Setter for responseModalities.abstract GenerateContentConfig.BuilderresponseSchema(Schema responseSchema) Setter for responseSchema.responseSchema(Schema.Builder responseSchemaBuilder) Setter for responseSchema builder.abstract GenerateContentConfig.BuilderroutingConfig(GenerationConfigRoutingConfig routingConfig) Setter for routingConfig.routingConfig(GenerationConfigRoutingConfig.Builder routingConfigBuilder) Setter for routingConfig builder.safetySettings(SafetySetting... safetySettings) Setter for safetySettings.safetySettings(SafetySetting.Builder... safetySettingsBuilders) Setter for safetySettings builder.abstract GenerateContentConfig.BuildersafetySettings(List<SafetySetting> safetySettings) Setter for safetySettings.abstract GenerateContentConfig.BuilderSetter for seed.abstract GenerateContentConfig.BuildershouldReturnHttpResponse(boolean shouldReturnHttpResponse) Setter for shouldReturnHttpResponse.abstract GenerateContentConfig.BuilderspeechConfig(SpeechConfig speechConfig) Setter for speechConfig.speechConfig(SpeechConfig.Builder speechConfigBuilder) Setter for speechConfig builder.stopSequences(String... stopSequences) Setter for stopSequences.abstract GenerateContentConfig.BuilderstopSequences(List<String> stopSequences) Setter for stopSequences.abstract GenerateContentConfig.BuildersystemInstruction(Content systemInstruction) Setter for systemInstruction.systemInstruction(Content.Builder systemInstructionBuilder) Setter for systemInstruction builder.abstract GenerateContentConfig.Buildertemperature(Float temperature) Setter for temperature.abstract GenerateContentConfig.BuilderthinkingConfig(ThinkingConfig thinkingConfig) Setter for thinkingConfig.thinkingConfig(ThinkingConfig.Builder thinkingConfigBuilder) Setter for thinkingConfig builder.abstract GenerateContentConfig.BuildertoolConfig(ToolConfig toolConfig) Setter for toolConfig.toolConfig(ToolConfig.Builder toolConfigBuilder) Setter for toolConfig builder.Setter for tools.tools(Tool.Builder... toolsBuilders) Setter for tools builder.abstract GenerateContentConfig.BuilderSetter for tools.abstract GenerateContentConfig.BuilderSetter for topK.abstract GenerateContentConfig.BuilderSetter for topP.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
httpOptions
Setter for httpOptions.httpOptions: Used to override HTTP request options.
-
httpOptions
@CanIgnoreReturnValue public GenerateContentConfig.Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) Setter for httpOptions builder.httpOptions: Used to override HTTP request options.
-
clearHttpOptions
Clears the value of httpOptions field. -
shouldReturnHttpResponse
public abstract GenerateContentConfig.Builder shouldReturnHttpResponse(boolean shouldReturnHttpResponse) Setter for shouldReturnHttpResponse.shouldReturnHttpResponse: If true, the raw HTTP response will be returned in the 'sdk_http_response' field.
-
clearShouldReturnHttpResponse
Clears the value of shouldReturnHttpResponse field. -
systemInstruction
Setter for systemInstruction.systemInstruction: Instructions for the model to steer it toward better performance. For example, "Answer as concisely as possible" or "Don't use technical terms in your response".
-
systemInstruction
@CanIgnoreReturnValue public GenerateContentConfig.Builder systemInstruction(Content.Builder systemInstructionBuilder) Setter for systemInstruction builder.systemInstruction: Instructions for the model to steer it toward better performance. For example, "Answer as concisely as possible" or "Don't use technical terms in your response".
-
clearSystemInstruction
Clears the value of systemInstruction field. -
temperature
Setter for temperature.temperature: Value that controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a less open-ended or creative response, while higher temperatures can lead to more diverse or creative results.
-
clearTemperature
Clears the value of temperature field. -
topP
Setter for topP.topP: Tokens are selected from the most to least probable until the sum of their probabilities equals this value. Use a lower value for less random responses and a higher value for more random responses.
-
clearTopP
Clears the value of topP field. -
topK
Setter for topK.topK: For each token selection step, the ``top_k`` tokens with the highest probabilities are sampled. Then tokens are further filtered based on ``top_p`` with the final token selected using temperature sampling. Use a lower number for less random responses and a higher number for more random responses.
-
clearTopK
Clears the value of topK field. -
candidateCount
Setter for candidateCount.candidateCount: Number of response variations to return.
-
clearCandidateCount
Clears the value of candidateCount field. -
maxOutputTokens
Setter for maxOutputTokens.maxOutputTokens: Maximum number of tokens that can be generated in the response.
-
clearMaxOutputTokens
Clears the value of maxOutputTokens field. -
stopSequences
Setter for stopSequences.stopSequences: List of strings that tells the model to stop generating text if one of the strings is encountered in the response.
-
stopSequences
Setter for stopSequences.stopSequences: List of strings that tells the model to stop generating text if one of the strings is encountered in the response.
-
clearStopSequences
Clears the value of stopSequences field. -
responseLogprobs
Setter for responseLogprobs.responseLogprobs: Whether to return the log probabilities of the tokens that were chosen by the model at each step.
-
clearResponseLogprobs
Clears the value of responseLogprobs field. -
logprobs
Setter for logprobs.logprobs: Number of top candidate tokens to return the log probabilities for at each generation step.
-
clearLogprobs
Clears the value of logprobs field. -
presencePenalty
Setter for presencePenalty.presencePenalty: Positive values penalize tokens that already appear in the generated text, increasing the probability of generating more diverse content.
-
clearPresencePenalty
Clears the value of presencePenalty field. -
frequencyPenalty
Setter for frequencyPenalty.frequencyPenalty: Positive values penalize tokens that repeatedly appear in the generated text, increasing the probability of generating more diverse content.
-
clearFrequencyPenalty
Clears the value of frequencyPenalty field. -
seed
Setter for seed.seed: When ``seed`` is fixed to a specific number, the model makes a best effort to provide the same response for repeated requests. By default, a random number is used.
-
clearSeed
Clears the value of seed field. -
responseMimeType
Setter for responseMimeType.responseMimeType: 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.
-
clearResponseMimeType
Clears the value of responseMimeType field. -
responseSchema
Setter for responseSchema.responseSchema: 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
@CanIgnoreReturnValue public GenerateContentConfig.Builder responseSchema(Schema.Builder responseSchemaBuilder) Setter for responseSchema builder.responseSchema: 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.
-
clearResponseSchema
Clears the value of responseSchema field. -
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.
-
clearResponseJsonSchema
Clears the value of responseJsonSchema field. -
routingConfig
public abstract GenerateContentConfig.Builder routingConfig(GenerationConfigRoutingConfig routingConfig) Setter for routingConfig.routingConfig: Configuration for model router requests.
-
routingConfig
@CanIgnoreReturnValue public GenerateContentConfig.Builder routingConfig(GenerationConfigRoutingConfig.Builder routingConfigBuilder) Setter for routingConfig builder.routingConfig: Configuration for model router requests.
-
clearRoutingConfig
Clears the value of routingConfig field. -
modelSelectionConfig
public abstract GenerateContentConfig.Builder modelSelectionConfig(ModelSelectionConfig modelSelectionConfig) Setter for modelSelectionConfig.modelSelectionConfig: Configuration for model selection.
-
modelSelectionConfig
@CanIgnoreReturnValue public GenerateContentConfig.Builder modelSelectionConfig(ModelSelectionConfig.Builder modelSelectionConfigBuilder) Setter for modelSelectionConfig builder.modelSelectionConfig: Configuration for model selection.
-
clearModelSelectionConfig
Clears the value of modelSelectionConfig field. -
safetySettings
Setter for safetySettings.safetySettings: Safety settings in the request to block unsafe content in the response.
-
safetySettings
@CanIgnoreReturnValue public GenerateContentConfig.Builder safetySettings(SafetySetting... safetySettings) Setter for safetySettings.safetySettings: Safety settings in the request to block unsafe content in the response.
-
safetySettings
@CanIgnoreReturnValue public GenerateContentConfig.Builder safetySettings(SafetySetting.Builder... safetySettingsBuilders) Setter for safetySettings builder.safetySettings: Safety settings in the request to block unsafe content in the response.
-
clearSafetySettings
Clears the value of safetySettings field. -
tools
Setter for tools.tools: Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.
-
tools
Setter for tools.tools: Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.
-
tools
Setter for tools builder.tools: Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.
-
clearTools
Clears the value of tools field. -
toolConfig
Setter for toolConfig.toolConfig: Associates model output to a specific function call.
-
toolConfig
@CanIgnoreReturnValue public GenerateContentConfig.Builder toolConfig(ToolConfig.Builder toolConfigBuilder) Setter for toolConfig builder.toolConfig: Associates model output to a specific function call.
-
clearToolConfig
Clears the value of toolConfig field. -
labels
Setter for labels.labels: Labels with user-defined metadata to break down billed charges.
-
clearLabels
Clears the value of labels field. -
cachedContent
Setter for cachedContent.cachedContent: Resource name of a context cache that can be used in subsequent requests.
-
clearCachedContent
Clears the value of cachedContent field. -
responseModalities
Setter for responseModalities.responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return.
-
responseModalities
@CanIgnoreReturnValue public GenerateContentConfig.Builder responseModalities(String... responseModalities) Setter for responseModalities.responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return.
-
clearResponseModalities
Clears the value of responseModalities field. -
mediaResolution
Setter for mediaResolution.mediaResolution: If specified, the media resolution specified will be used.
-
clearMediaResolution
Clears the value of mediaResolution field. -
mediaResolution
@CanIgnoreReturnValue public GenerateContentConfig.Builder mediaResolution(MediaResolution.Known knownType) Setter for mediaResolution given a known enum.mediaResolution: If specified, the media resolution specified will be used.
-
mediaResolution
Setter for mediaResolution given a string.mediaResolution: If specified, the media resolution specified will be used.
-
speechConfig
Setter for speechConfig.speechConfig: The speech generation configuration.
-
speechConfig
@CanIgnoreReturnValue public GenerateContentConfig.Builder speechConfig(SpeechConfig.Builder speechConfigBuilder) Setter for speechConfig builder.speechConfig: The speech generation configuration.
-
clearSpeechConfig
Clears the value of speechConfig field. -
audioTimestamp
Setter for audioTimestamp.audioTimestamp: If enabled, audio timestamp will be included in the request to the model.
-
clearAudioTimestamp
Clears the value of audioTimestamp field. -
automaticFunctionCalling
public abstract GenerateContentConfig.Builder automaticFunctionCalling(AutomaticFunctionCallingConfig automaticFunctionCalling) Setter for automaticFunctionCalling.automaticFunctionCalling: The configuration for automatic function calling.
-
automaticFunctionCalling
@CanIgnoreReturnValue public GenerateContentConfig.Builder automaticFunctionCalling(AutomaticFunctionCallingConfig.Builder automaticFunctionCallingBuilder) Setter for automaticFunctionCalling builder.automaticFunctionCalling: The configuration for automatic function calling.
-
clearAutomaticFunctionCalling
Clears the value of automaticFunctionCalling field. -
thinkingConfig
Setter for thinkingConfig.thinkingConfig: The thinking features configuration.
-
thinkingConfig
@CanIgnoreReturnValue public GenerateContentConfig.Builder thinkingConfig(ThinkingConfig.Builder thinkingConfigBuilder) Setter for thinkingConfig builder.thinkingConfig: The thinking features configuration.
-
clearThinkingConfig
Clears the value of thinkingConfig field. -
imageConfig
Setter for imageConfig.imageConfig: The image generation configuration.
-
imageConfig
@CanIgnoreReturnValue public GenerateContentConfig.Builder imageConfig(ImageConfig.Builder imageConfigBuilder) Setter for imageConfig builder.imageConfig: The image generation configuration.
-
clearImageConfig
Clears the value of imageConfig field. -
build
-