Class GenerateImagesConfig
-
- All Implemented Interfaces:
public abstract class GenerateImagesConfig extends JsonSerializable
The config for generating an images.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classGenerateImagesConfig.BuilderBuilder for GenerateImagesConfig.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description GenerateImagesConfig()
-
Method Summary
Modifier and Type Method Description abstract Optional<HttpOptions>httpOptions()Used to override HTTP request options. abstract Optional<String>outputGcsUri()Cloud Storage URI used to store the generated images. abstract Optional<String>negativePrompt()Description of what to discourage in the generated images. abstract Optional<Integer>numberOfImages()Number of images to generate. abstract Optional<String>aspectRatio()Aspect ratio of the generated images. abstract Optional<Float>guidanceScale()Controls how much the model adheres to the text prompt. abstract Optional<Integer>seed()Random seed for image generation. abstract Optional<SafetyFilterLevel>safetyFilterLevel()Filter level for safety filtering. abstract Optional<PersonGeneration>personGeneration()Allows generation of people by the model. abstract Optional<Boolean>includeSafetyAttributes()Whether to report the safety scores of each generated image and the positive prompt in the response. abstract Optional<Boolean>includeRaiReason()Whether to include the Responsible AI filter reason if the image is filtered out of the response. abstract Optional<ImagePromptLanguage>language()Language of the text in the prompt. abstract Optional<String>outputMimeType()MIME type of the generated image. abstract Optional<Integer>outputCompressionQuality()Compression quality of the generated image (for ``image/jpeg`` only). abstract Optional<Boolean>addWatermark()Whether to add a watermark to the generated images. abstract Optional<Map<String, String>>labels()User specified labels to track billing usage. abstract Optional<String>imageSize()The size of the largest dimension of the generated image. abstract Optional<Boolean>enhancePrompt()Whether to use the prompt rewriting logic. static GenerateImagesConfig.Builderbuilder()Instantiates a builder for GenerateImagesConfig. abstract GenerateImagesConfig.BuildertoBuilder()Creates a builder with the same values as this instance. static GenerateImagesConfigfromJson(String jsonString)Deserializes a JSON string to a GenerateImagesConfig object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
httpOptions
abstract Optional<HttpOptions> httpOptions()
Used to override HTTP request options.
-
outputGcsUri
abstract Optional<String> outputGcsUri()
Cloud Storage URI used to store the generated images.
-
negativePrompt
abstract Optional<String> negativePrompt()
Description of what to discourage in the generated images.
-
numberOfImages
abstract Optional<Integer> numberOfImages()
Number of images to generate.
-
aspectRatio
abstract Optional<String> aspectRatio()
Aspect ratio of the generated images. Supported values are "1:1", "3:4", "4:3", "9:16", and "16:9".
-
guidanceScale
abstract Optional<Float> guidanceScale()
Controls how much the model adheres to the text prompt. Large values increase output and prompt alignment, but may compromise image quality.
-
seed
abstract Optional<Integer> seed()
Random seed for image generation. This is not available when ``add_watermark`` is set to true.
-
safetyFilterLevel
abstract Optional<SafetyFilterLevel> safetyFilterLevel()
Filter level for safety filtering.
-
personGeneration
abstract Optional<PersonGeneration> personGeneration()
Allows generation of people by the model.
-
includeSafetyAttributes
abstract Optional<Boolean> includeSafetyAttributes()
Whether to report the safety scores of each generated image and the positive prompt in the response.
-
includeRaiReason
abstract Optional<Boolean> includeRaiReason()
Whether to include the Responsible AI filter reason if the image is filtered out of the response.
-
language
abstract Optional<ImagePromptLanguage> language()
Language of the text in the prompt.
-
outputMimeType
abstract Optional<String> outputMimeType()
MIME type of the generated image.
-
outputCompressionQuality
abstract Optional<Integer> outputCompressionQuality()
Compression quality of the generated image (for ``image/jpeg`` only).
-
addWatermark
abstract Optional<Boolean> addWatermark()
Whether to add a watermark to the generated images.
-
labels
abstract Optional<Map<String, String>> labels()
User specified labels to track billing usage.
-
imageSize
abstract Optional<String> imageSize()
The size of the largest dimension of the generated image. Supported sizes are 1K and 2K (not supported for Imagen 3 models).
-
enhancePrompt
abstract Optional<Boolean> enhancePrompt()
Whether to use the prompt rewriting logic.
-
builder
static GenerateImagesConfig.Builder builder()
Instantiates a builder for GenerateImagesConfig.
-
toBuilder
abstract GenerateImagesConfig.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static GenerateImagesConfig fromJson(String jsonString)
Deserializes a JSON string to a GenerateImagesConfig object.
-
-
-
-