Use model configuration to control responses

In each call to a model, you can send along a model configuration to control how the model generates a response. Each model offers different configuration options.

You can experiment with prompts and model configurations and rapidly iterate using Vertex AI Studio.

Jump to Gemini config options Jump to Imagen config options



Configuration options for Gemini models

This section shows you how to set up a configuration for use with Gemini models and provides a description of each parameter.

Set up a model configuration for Gemini models

You can find a description of each parameter in the next section of this page.

Description of each parameter for use with Gemini models

Here is a high-level overview of the available parameters, as applicable. You can find a comprehensive list of parameters and their values in the Google Cloud documentation.

Parameter Description Default value
Audio timestamp
audioTimestamp

A boolean that enables timestamp understanding for audio-only input files.

Only applicable when using generateContent or generateContentStream calls and the input type is an audio-only file.

false
Frequency penalty
frequencyPenalty
Controls the probability of including tokens that repeatedly appear in the generated response.
Positive values penalize tokens that repeatedly appear in the generated content, decreasing the probability of repeating content.
---
Max output tokens
maxOutputTokens
Maximum number of tokens that can be generated in the response. ---
Presence penalty
presencePenalty
Controls the probability of including tokens that already appear in the generated response.
Positive values penalize tokens that already appear in the generated content, increasing the probability of generating more diverse content.
---
Stop sequences
stopSequences
Specifies a list of strings that tells the model to stop generating content if one of the strings is encountered in the response. ---
Temperature
temperature
Controls the degree of randomness in the response.
Lower temperatures result in more deterministic responses, and higher temperatures result in more diverse or creative responses.
Depends on the model
Top-K
topK
Limits the number of highest probability words used in the generated content.
A top-K value of 1 means the next selected token should be the most probable among all tokens in the model's vocabulary, while a top-K value of n means that the next token should be selected from among the n most probable tokens (all based on the temperature that's set).
Depends on the model
Top-P
topP
Controls diversity of generated content.
Tokens are selected from the most probable (see top-K above) to least probable until the sum of their probabilities equals the top-P value.
Depends on the model



Configuration options for Imagen models

This section shows you how to set up a configuration for use with Imagen models and provides a description of each parameter.

Set up a model configuration for Imagen models

You can find a description of each parameter in the next section of this page.

Description of each parameter for use with Imagen models

Here is a high-level overview of the available parameters, as applicable. You can find a comprehensive list of parameters and their values in the Google Cloud documentation.

Parameter Description Default value
Negative prompt
negativePrompt
A description of what you want to omit in generated images

This parameter is not yet supported by imagen-3.0-generate-002.

---
Number of results
numberOfImages
The number of generated images returned for each request default is one image for Imagen 3 models
Aspect ratio
aspectRatio
The ratio of width to height of generated images default is square (1:1)
Image format
imageFormat
The output options, like the image format (MIME type) and level of compression of generated images default MIME type is PNG
default compression is 75 (if MIME type is set to JPEG)
Watermark
addWatermark
Whether to add a non-visible digital watermark (called a SynthID) to generated images default is true for Imagen 3 models
Person generation
personGeneration
Whether to allow generation of people by the model default depends on the model



Other options to control content generation

  • Learn more about prompt design so that you can influence the model to generate output specific to your needs.
  • Use safety settings to adjust the likelihood of getting responses that may be considered harmful, including hate speech and sexually explicit content.
  • Set system instructions to steer the behavior of the model. This feature is like a "preamble" that you add before the model gets exposed to any further instructions from the end user.
  • Pass a response schema along with the prompt to specify a specific output schema. This feature is most commonly used when generating JSON output, but it can also be used for classification tasks (like when you want the model to use specific labels or tags).