Skip to content

Commit 4d44301

Browse files
author
David Motsonashvili
committed
fixes for tests
1 parent d7296c3 commit 4d44301

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ internal constructor(
7272
*/
7373
public suspend fun generateImages(prompt: String): ImagenGenerationResponse<ImagenInlineImage> =
7474
try {
75-
controller.generateImage(constructRequest(prompt, null, generationConfig)).toPublicInline()
7675
controller
7776
.generateImage(constructRequest(prompt, null, generationConfig))
7877
.validate()

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/APIController.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ import kotlinx.coroutines.flow.map
6060
import kotlinx.coroutines.launch
6161
import kotlinx.coroutines.tasks.await
6262
import kotlinx.coroutines.withTimeout
63+
import kotlinx.serialization.ExperimentalSerializationApi
6364
import kotlinx.serialization.json.Json
6465

66+
@OptIn(ExperimentalSerializationApi::class)
6567
internal val JSON = Json {
6668
ignoreUnknownKeys = true
6769
prettyPrint = false
6870
isLenient = true
71+
explicitNulls = false
6972
}
7073

7174
/**

firebase-vertexai/src/test/java/com/google/firebase/vertexai/UnarySnapshotTests.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,14 @@ internal class UnarySnapshotTests {
503503
}
504504
}
505505

506+
@Test
507+
fun `generateImages should return when some images are filtered -- base64`() =
508+
goldenUnaryFile("unary-failure-generate-images-base64-some-filtered.json") {
509+
withTimeout(testTimeout) {
510+
imagenModel.generateImages("prompt").images.isEmpty() shouldBe false
511+
}
512+
}
513+
506514
@Test
507515
fun `generateImages should throw when prompt blocked`() =
508516
goldenUnaryFile(

0 commit comments

Comments
 (0)