GenerateContentConfig

@Serializable
data class GenerateContentConfig(val httpOptions: HttpOptions? = null, val shouldReturnHttpResponse: Boolean? = null, val systemInstruction: Content? = null, val temperature: Double? = null, val topP: Double? = null, val topK: Double? = null, val candidateCount: Int? = null, val maxOutputTokens: Int? = null, val stopSequences: List<String>? = null, val responseLogprobs: Boolean? = null, val logprobs: Int? = null, val presencePenalty: Double? = null, val frequencyPenalty: Double? = null, val seed: Int? = null, val responseMimeType: String? = null, val responseSchema: Schema? = null, val responseJsonSchema: JsonElement? = null, val modelSelectionConfig: ModelSelectionConfig? = null, val safetySettings: List<SafetySetting>? = null, val tools: List<Tool>? = null, val toolConfig: ToolConfig? = null, val cachedContent: String? = null, val responseModalities: List<String>? = null, val mediaResolution: MediaResolution? = null, val speechConfig: SpeechConfig? = null, val audioTimestamp: Boolean? = null, val thinkingConfig: ThinkingConfig? = null, val imageConfig: ImageConfig? = null, val enableEnhancedCivicAnswers: Boolean? = null, val modelArmorConfig: ModelArmorConfig? = null, val serviceTier: ServiceTier? = null, val routingConfig: GenerationConfigRoutingConfig? = null, val labels: Map<String, String>? = null)

Optional model configuration parameters.

For more information, see Content generation parameters <https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>_.

Constructors

Link copied to clipboard
constructor(httpOptions: HttpOptions? = null, shouldReturnHttpResponse: Boolean? = null, systemInstruction: Content? = null, temperature: Double? = null, topP: Double? = null, topK: Double? = null, candidateCount: Int? = null, maxOutputTokens: Int? = null, stopSequences: List<String>? = null, responseLogprobs: Boolean? = null, logprobs: Int? = null, presencePenalty: Double? = null, frequencyPenalty: Double? = null, seed: Int? = null, responseMimeType: String? = null, responseSchema: Schema? = null, responseJsonSchema: JsonElement? = null, modelSelectionConfig: ModelSelectionConfig? = null, safetySettings: List<SafetySetting>? = null, tools: List<Tool>? = null, toolConfig: ToolConfig? = null, cachedContent: String? = null, responseModalities: List<String>? = null, mediaResolution: MediaResolution? = null, speechConfig: SpeechConfig? = null, audioTimestamp: Boolean? = null, thinkingConfig: ThinkingConfig? = null, imageConfig: ImageConfig? = null, enableEnhancedCivicAnswers: Boolean? = null, modelArmorConfig: ModelArmorConfig? = null, serviceTier: ServiceTier? = null, routingConfig: GenerationConfigRoutingConfig? = null, labels: Map<String, String>? = null)

Properties

Link copied to clipboard
val audioTimestamp: Boolean? = null

If enabled, audio timestamp will be included in the request to the model.

Link copied to clipboard
val cachedContent: String? = null

Resource name of a context cache that can be used in subsequent requests.

Link copied to clipboard
val candidateCount: Int? = null

Number of response variations to return.

Link copied to clipboard

Enables enhanced civic answers. It may not be available for all models. This field is not supported in Gemini Enterprise Agent Platform.

Link copied to clipboard

Positive values penalize tokens that repeatedly appear in the generated text, increasing the probability of generating more diverse content.

Link copied to clipboard

Used to override HTTP request options.

Link copied to clipboard

The image generation configuration.

Link copied to clipboard
val labels: Map<String, String>? = null

Labels with user-defined metadata to break down billed charges.

Link copied to clipboard
val logprobs: Int? = null

Number of top candidate tokens to return the log probabilities for at each generation step.

Link copied to clipboard
val maxOutputTokens: Int? = null

Maximum number of tokens that can be generated in the response.

Link copied to clipboard

If specified, the media resolution specified will be used.

Link copied to clipboard

Settings for prompt and response sanitization using the Model Armor service. If supplied, safety_settings must not be supplied.

Link copied to clipboard

Configuration for model selection.

Link copied to clipboard
val presencePenalty: Double? = null

Positive values penalize tokens that already appear in the generated text, increasing the probability of generating more diverse content.

Link copied to clipboard
val responseJsonSchema: JsonElement? = null

Optional. Output schema of the generated response. This is an alternative to response_schema that accepts JSON Schema. 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

Link copied to clipboard

Whether to return the log probabilities of the tokens that were chosen by the model at each step.

Link copied to clipboard

Output response mimetype of the generated candidate text. Supported mimetype:

Link copied to clipboard

The requested modalities of the response. Represents the set of modalities that the model can return.

Link copied to clipboard
val responseSchema: Schema? = null

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. If set, a compatible response_mime_type must also be set. Compatible mimetypes: application/json: Schema for JSON response.

Link copied to clipboard

Configuration for model router requests.

Link copied to clipboard

Safety settings in the request to block unsafe content in the response.

Link copied to clipboard
val seed: Int? = null

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.

Link copied to clipboard

The service tier to use for the request. For example, ServiceTier.FLEX.

Link copied to clipboard

If true, the raw HTTP response will be returned in the 'sdk_http_response' field.

Link copied to clipboard

The speech generation configuration.

Link copied to clipboard
val stopSequences: List<String>? = null

List of strings that tells the model to stop generating text if one of the strings is encountered in the response.

Link copied to clipboard

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".

Link copied to clipboard
val temperature: Double? = null

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.

Link copied to clipboard

The thinking features configuration.

Link copied to clipboard
val toolConfig: ToolConfig? = null

Associates model output to a specific function call.

Link copied to clipboard
val tools: List<Tool>? = null

Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.

Link copied to clipboard
val topK: Double? = null

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.

Link copied to clipboard
val topP: Double? = null

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.