@@ -26,6 +26,8 @@ package com.google.firebase.vertexai.type
2626 * @param imageFormat The file format/compression of the generated images.
2727 * @param addWatermark Adds an invisible watermark to mark the image as AI generated.
2828 */
29+ import kotlin.jvm.JvmField
30+
2931@PublicPreviewAPI
3032public class ImagenGenerationConfig (
3133 public val negativePrompt : String? = null ,
@@ -41,48 +43,37 @@ public class ImagenGenerationConfig(
4143 * idiomatic experience.
4244 */
4345 public class Builder {
44- private var negativePrompt: String? = null
45- private var numberOfImages: Int? = 1
46- private var aspectRatio: ImagenAspectRatio ? = null
47- private var imageFormat: ImagenImageFormat ? = null
48- private var addWatermark: Boolean? = null
46+ @JvmField public var negativePrompt: String? = null
47+ @JvmField public var numberOfImages: Int? = 1
48+ @JvmField public var aspectRatio: ImagenAspectRatio ? = null
49+ @JvmField public var imageFormat: ImagenImageFormat ? = null
50+ @JvmField public var addWatermark: Boolean? = null
4951
50- /* *
51- * See [ImagenGenerationConfig.negativePrompt].
52- */
52+ /* * See [ImagenGenerationConfig.negativePrompt]. */
5353 public fun setNegativePrompt (negativePrompt : String ): Builder = apply {
5454 this .negativePrompt = negativePrompt
5555 }
5656
57- /* *
58- * See [ImagenGenerationConfig.numberOfImages].
59- */
57+ /* * See [ImagenGenerationConfig.numberOfImages]. */
6058 public fun setNumberOfImages (numberOfImages : Int ): Builder = apply {
6159 this .numberOfImages = numberOfImages
6260 }
6361
64- /* *
65- * See [ImagenGenerationConfig.aspectRatio].
66- */
62+ /* * See [ImagenGenerationConfig.aspectRatio]. */
6763 public fun setAspectRatio (aspectRatio : ImagenAspectRatio ): Builder = apply {
6864 this .aspectRatio = aspectRatio
6965 }
7066
71- /* *
72- * See [ImagenGenerationConfig.imageFormat].
73- */
67+ /* * See [ImagenGenerationConfig.imageFormat]. */
7468 public fun setImageFormat (imageFormat : ImagenImageFormat ): Builder = apply {
7569 this .imageFormat = imageFormat
7670 }
7771
78- /* *
79- * See [ImagenGenerationConfig.addWatermark].
80- */
72+ /* * See [ImagenGenerationConfig.addWatermark]. */
8173 public fun setAddWatermark (addWatermark : Boolean ): Builder = apply {
8274 this .addWatermark = addWatermark
8375 }
8476
85-
8677 /* *
8778 * Alternative casing for [ImagenGenerationConfig.Builder]:
8879 * ```
@@ -126,3 +117,14 @@ public fun imagenGenerationConfig(
126117 builder.init ()
127118 return builder.build()
128119}
120+
121+ @OptIn(PublicPreviewAPI ::class )
122+ public fun xx () {
123+ imagenGenerationConfig {
124+ negativePrompt = " People, black and white, painting"
125+ numberOfImages = 1
126+ aspectRatio = ImagenAspectRatio .SQUARE_1x1
127+ imageFormat = ImagenImageFormat .png()
128+ addWatermark = false
129+ }
130+ }
0 commit comments