Package com.google.genai.types
Class GenerateContentConfig
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.GenerateContentConfig
Optional model configuration parameters.
For more information, see `Content generation parameters <https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>`_.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for GenerateContentConfig. -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
objectMapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIf enabled, audio timestamp will be included in the request to the model.builder()Instantiates a builder for GenerateContentConfig.Resource name of a context cache that can be used in subsequent requests.Number of response variations to return.Positive values penalize tokens that repeatedly appear in the generated text, increasing the probability of generating more diverse content.static GenerateContentConfigDeserializes a JSON string to a GenerateContentConfig object.labels()Labels with user-defined metadata to break down billed charges.logprobs()Number of top candidate tokens to return the log probabilities for at each generation step.Maximum number of tokens that can be generated in the response.If specified, the media resolution specified will be used.Positive values penalize tokens that already appear in the generated text, increasing the probability of generating more diverse content.Whether to return the log probabilities of the tokens that were chosen by the model at each step.Output response media type of the generated candidate text.The requested modalities of the response.Schema that the generated candidate text must adhere to.abstract Optional<GenerationConfigRoutingConfig>Configuration for model router requests.abstract Optional<List<SafetySetting>>Safety settings in the request to block unsafe content in the response.seed()When ``seed`` is fixed to a specific number, the model makes a best effort to provide the same response for repeated requests.abstract Optional<SpeechConfig>The speech generation configuration.List of strings that tells the model to stop generating text if one of the strings is encountered in the response.Instructions for the model to steer it toward better performance.Value that controls the degree of randomness in token selection.abstract Optional<ThinkingConfig>The thinking features configuration.abstract GenerateContentConfig.BuilderCreates a builder with the same values as this instance.abstract Optional<ToolConfig>Associates model output to a specific function call.tools()Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.topK()For each token selection step, the ``top_k`` tokens with the highest probabilities are sampled.topP()Tokens are selected from the most to least probable until the sum of their probabilities equals this value.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, toJson, toJsonNode, toJsonString
-
Constructor Details
-
GenerateContentConfig
public GenerateContentConfig()
-
-
Method Details
-
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". -
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. -
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. -
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. -
candidateCount
Number of response variations to return. -
maxOutputTokens
Maximum number of tokens that can be generated in the response. -
stopSequences
List of strings that tells the model to stop generating text if one of the strings is encountered in the response. -
responseLogprobs
Whether to return the log probabilities of the tokens that were chosen by the model at each step. -
logprobs
Number of top candidate tokens to return the log probabilities for at each generation step. -
presencePenalty
Positive values penalize tokens that already appear in the generated text, increasing the probability of generating more diverse content. -
frequencyPenalty
Positive values penalize tokens that repeatedly appear in the generated text, increasing the probability of generating more diverse content. -
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. -
responseMimeType
Output response media type of the generated candidate text. -
responseSchema
Schema that the generated candidate text must adhere to. -
routingConfig
Configuration for model router requests. -
safetySettings
Safety settings in the request to block unsafe content in the response. -
tools
Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model. -
toolConfig
Associates model output to a specific function call. -
labels
Labels with user-defined metadata to break down billed charges. -
cachedContent
Resource name of a context cache that can be used in subsequent requests. -
responseModalities
The requested modalities of the response. Represents the set of modalities that the model can return. -
mediaResolution
If specified, the media resolution specified will be used. -
speechConfig
The speech generation configuration. -
audioTimestamp
If enabled, audio timestamp will be included in the request to the model. -
thinkingConfig
The thinking features configuration. -
builder
Instantiates a builder for GenerateContentConfig. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a GenerateContentConfig object.
-