Class GenerateImagesConfig

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.GenerateImagesConfig

public abstract class GenerateImagesConfig extends JsonSerializable
The config for generating an images.
  • Constructor Details

    • GenerateImagesConfig

      public GenerateImagesConfig()
  • Method Details

    • httpOptions

      public abstract Optional<HttpOptions> httpOptions()
      Used to override HTTP request options.
    • outputGcsUri

      public abstract Optional<String> outputGcsUri()
      Cloud Storage URI used to store the generated images.
    • negativePrompt

      public abstract Optional<String> negativePrompt()
      Description of what to discourage in the generated images.
    • numberOfImages

      public abstract Optional<Integer> numberOfImages()
      Number of images to generate.
    • aspectRatio

      public 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

      public 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

      public abstract Optional<Integer> seed()
      Random seed for image generation. This is not available when ``add_watermark`` is set to true.
    • safetyFilterLevel

      public abstract Optional<SafetyFilterLevel> safetyFilterLevel()
      Filter level for safety filtering.
    • personGeneration

      public abstract Optional<PersonGeneration> personGeneration()
      Allows generation of people by the model.
    • includeSafetyAttributes

      public abstract Optional<Boolean> includeSafetyAttributes()
      Whether to report the safety scores of each generated image and the positive prompt in the response.
    • includeRaiReason

      public abstract Optional<Boolean> includeRaiReason()
      Whether to include the Responsible AI filter reason if the image is filtered out of the response.
    • language

      public abstract Optional<ImagePromptLanguage> language()
      Language of the text in the prompt.
    • outputMimeType

      public abstract Optional<String> outputMimeType()
      MIME type of the generated image.
    • outputCompressionQuality

      public abstract Optional<Integer> outputCompressionQuality()
      Compression quality of the generated image (for ``image/jpeg`` only).
    • addWatermark

      public abstract Optional<Boolean> addWatermark()
      Whether to add a watermark to the generated images.
    • imageSize

      public 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

      public abstract Optional<Boolean> enhancePrompt()
      Whether to use the prompt rewriting logic.
    • builder

      public static GenerateImagesConfig.Builder builder()
      Instantiates a builder for GenerateImagesConfig.
    • toBuilder

      public abstract GenerateImagesConfig.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static GenerateImagesConfig fromJson(String jsonString)
      Deserializes a JSON string to a GenerateImagesConfig object.