File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/test/java/com/google/firebase/ai Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import com.google.firebase.ai.util.goldenDevAPIUnaryFile
2424import io.kotest.assertions.throwables.shouldThrow
2525import io.kotest.matchers.should
2626import io.kotest.matchers.shouldBe
27+ import io.kotest.matchers.shouldNotBe
2728import io.ktor.http.HttpStatusCode
2829import kotlin.time.Duration.Companion.seconds
2930import kotlinx.coroutines.withTimeout
@@ -56,6 +57,21 @@ internal class DevAPIUnarySnapshotTests {
5657 }
5758 }
5859
60+ @Test
61+ fun `citation returns correctly` () =
62+ goldenDevAPIUnaryFile(" unary-success-citations.json" ) {
63+ withTimeout(testTimeout) {
64+ val response = model.generateContent(" prompt" )
65+
66+ response.candidates.isEmpty() shouldBe false
67+ response.candidates.first().citationMetadata?.citations?.size shouldBe 4
68+ response.candidates.first().citationMetadata?.citations?.forEach {
69+ it.startIndex shouldNotBe null
70+ it.endIndex shouldNotBe null
71+ }
72+ }
73+ }
74+
5975 @Test
6076 fun `response blocked for safety` () =
6177 goldenDevAPIUnaryFile(" unary-failure-finish-reason-safety.txt" ) {
Original file line number Diff line number Diff line change 1717# This script replaces mock response files for Vertex AI unit tests with a fresh
1818# clone of the shared repository of Vertex AI test data.
1919
20- RESPONSES_VERSION=' v10 .*' # The major version of mock responses to use
20+ RESPONSES_VERSION=' v11 .*' # The major version of mock responses to use
2121REPO_NAME=" vertexai-sdk-test-data"
2222REPO_LINK=" https://github.com/FirebaseExtended/$REPO_NAME .git"
2323
You can’t perform that action at this time.
0 commit comments