@@ -33,13 +33,32 @@ public class ImagenGenerationConfig(
3333 public val imageFormat : ImagenImageFormat ? = null ,
3434 public val addWatermark : Boolean? = null ,
3535) {
36+ /* *
37+ * Builder for creating a [ImagenGenerationConfig].
38+ *
39+ * Mainly intended for Java interop. Kotlin consumers should use [imagenGenerationConfig] for a
40+ * more idiomatic experience.
41+ *
42+ * @property negativePrompt See [ImagenGenerationConfig.negativePrompt].
43+ * @property numberOfImages See [ImagenGenerationConfig.numberOfImages].
44+ * @property aspectRatio See [ImagenGenerationConfig.aspectRatio].
45+ * @property imageFormat See [ImagenGenerationConfig.imageFormat]
46+ * @property addWatermark See [ImagenGenerationConfig.addWatermark]
47+ * @see [imagenGenerationConfig]
48+ */
3649 public class Builder {
3750 @JvmField public var negativePrompt: String? = null
3851 @JvmField public var numberOfImages: Int? = 1
3952 @JvmField public var aspectRatio: ImagenAspectRatio ? = null
4053 @JvmField public var imageFormat: ImagenImageFormat ? = null
4154 @JvmField public var addWatermark: Boolean? = null
4255
56+ /* *
57+ * Alternative casing for [ImagenGenerationConfig.Builder]:
58+ * ```
59+ * val config = GenerationConfig.builder()
60+ * ```
61+ */
4362 public fun build (): ImagenGenerationConfig =
4463 ImagenGenerationConfig (
4564 negativePrompt = negativePrompt,
@@ -55,6 +74,20 @@ public class ImagenGenerationConfig(
5574 }
5675}
5776
77+ /* *
78+ * Helper method to construct a [ImagenGenerationConfig] in a DSL-like manner.
79+ *
80+ * Example Usage:
81+ * ```
82+ * imagenGenerationConfig {
83+ * negativePrompt = "People, black and white, painting"
84+ * numberOfImages = 1
85+ * aspectRatio = ImagenAspecRatio.SQUARE_1x1
86+ * imageFormat = ImagenImageFormat.png()
87+ * addWatermark = false
88+ * }
89+ * ```
90+ */
5891public fun imagenGenerationConfig (
5992 init : ImagenGenerationConfig .Builder .() -> Unit
6093): ImagenGenerationConfig {
0 commit comments