Skip to content

Commit 316e187

Browse files
author
David Motsonashvili
committed
format
1 parent 269cda9 commit 316e187

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/ImageModel.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ import com.google.firebase.vertexai.internal.util.toInternal
2828
import com.google.firebase.vertexai.internal.util.toPublicGCS
2929
import com.google.firebase.vertexai.internal.util.toPublicInline
3030
import com.google.firebase.vertexai.type.FirebaseVertexAIException
31-
import com.google.firebase.vertexai.type.ImagenSafetySettings
3231
import com.google.firebase.vertexai.type.ImagenGCSImage
3332
import com.google.firebase.vertexai.type.ImagenGenerationConfig
3433
import com.google.firebase.vertexai.type.ImagenGenerationResponse
3534
import com.google.firebase.vertexai.type.ImagenInlineImage
35+
import com.google.firebase.vertexai.type.ImagenSafetySettings
3636
import com.google.firebase.vertexai.type.PromptBlockedException
3737
import com.google.firebase.vertexai.type.RequestOptions
3838
import kotlin.time.Duration
@@ -115,7 +115,10 @@ internal constructor(
115115
prompt: String,
116116
): ImagenGenerationResponse<ImagenInlineImage> =
117117
try {
118-
controller.generateImage(constructRequest(prompt, null, generationConfig)).toPublicInline().validate()
118+
controller
119+
.generateImage(constructRequest(prompt, null, generationConfig))
120+
.toPublicInline()
121+
.validate()
119122
} catch (e: Throwable) {
120123
throw FirebaseVertexAIException.from(e)
121124
}
@@ -131,7 +134,10 @@ internal constructor(
131134
gcsUri: String,
132135
): ImagenGenerationResponse<ImagenGCSImage> =
133136
try {
134-
controller.generateImage(constructRequest(prompt, gcsUri, generationConfig)).toPublicGCS().validate()
137+
controller
138+
.generateImage(constructRequest(prompt, gcsUri, generationConfig))
139+
.toPublicGCS()
140+
.validate()
135141
} catch (e: Throwable) {
136142
throw FirebaseVertexAIException.from(e)
137143
}
@@ -164,8 +170,7 @@ internal constructor(
164170
}
165171
}
166172

167-
private fun <T> ImagenGenerationResponse<T>.validate():
168-
ImagenGenerationResponse<T> {
173+
private fun <T> ImagenGenerationResponse<T>.validate(): ImagenGenerationResponse<T> {
169174
if (images.isEmpty()) {
170175
throw PromptBlockedException(message = filteredReason ?: ImageModel.DEFAULT_FILTERED_ERROR)
171176
}

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationConfig.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ package com.google.firebase.vertexai.type
2626
* @param addWatermark Adds an invisible watermark to mark the image as AI generated.
2727
*/
2828
public class ImagenGenerationConfig(
29-
public val negativePrompt: String? = null,
30-
public val numberOfImages: Int? = 1,
31-
public val aspectRatio: ImagenAspectRatio? = null,
32-
public val imageFormat: ImagenImageFormat? = null,
33-
public val addWatermark: Boolean? = null
29+
public val negativePrompt: String? = null,
30+
public val numberOfImages: Int? = 1,
31+
public val aspectRatio: ImagenAspectRatio? = null,
32+
public val imageFormat: ImagenImageFormat? = null,
33+
public val addWatermark: Boolean? = null
3434
) {}

0 commit comments

Comments
 (0)