Skip to content

Commit 4f1aee6

Browse files
authored
Merge branch 'main' into rl.storage.fix
2 parents c287f71 + 525f293 commit 4f1aee6

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

.github/workflows/check-vertexai-responses.yml renamed to .github/workflows/check-firebaseai-responses.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check Vertex AI Responses
1+
name: Check Firebase AI Responses
22

33
on: pull_request
44

@@ -10,30 +10,30 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1212
- name: Clone mock responses
13-
run: firebase-vertexai/update_responses.sh
13+
run: firebase-ai/update_responses.sh
1414
- name: Find cloned and latest versions
1515
run: |
1616
CLONED=$(git describe --tags)
1717
LATEST=$(git tag --sort=v:refname | tail -n1)
1818
echo "cloned_tag=$CLONED" >> $GITHUB_ENV
1919
echo "latest_tag=$LATEST" >> $GITHUB_ENV
20-
working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data
20+
working-directory: firebase-ai/src/test/resources/vertexai-sdk-test-data
2121
- name: Find comment from previous run if exists
2222
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
2323
id: fc
2424
with:
2525
issue-number: ${{github.event.number}}
26-
body-includes: Vertex AI Mock Responses Check
26+
body-includes: Firebase AI Mock Responses Check
2727
- name: Comment on PR if newer version is available
2828
if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
2929
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
3030
with:
3131
issue-number: ${{github.event.number}}
3232
body: >
33-
### Vertex AI Mock Responses Check :warning:
33+
### Firebase AI Mock Responses Check :warning:
3434
35-
A newer major version of the mock responses for Vertex AI unit tests is available.
36-
[update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh)
35+
A newer major version of the mock responses for Firebase AI unit tests is available.
36+
[update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-ai/update_responses.sh)
3737
should be updated to clone the latest version of the responses: `${{env.latest_tag}}`
3838
- name: Delete comment when version gets updated
3939
if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ internal constructor(
165165

166166
suspend fun getWebSocketSession(location: String): ClientWebSocketSession =
167167
client.webSocketSession(getBidiEndpoint(location))
168+
168169
fun generateContentStream(
169170
request: GenerateContentRequest
170171
): Flow<GenerateContentResponse.Internal> =

firebase-ai/src/test/java/com/google/firebase/ai/DevAPIStreamingSnapshotTests.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ internal class DevAPIStreamingSnapshotTests {
4242
withTimeout(testTimeout) {
4343
val responseList = responses.toList()
4444
responseList.isEmpty() shouldBe false
45-
responseList.first().candidates.first().finishReason shouldBe FinishReason.STOP
46-
responseList.first().candidates.first().content.parts.isEmpty() shouldBe false
47-
responseList.first().candidates.first().safetyRatings.isEmpty() shouldBe false
45+
responseList.last().candidates.first().apply {
46+
finishReason shouldBe FinishReason.STOP
47+
content.parts.isEmpty() shouldBe false
48+
}
4849
}
4950
}
5051

@@ -56,10 +57,9 @@ internal class DevAPIStreamingSnapshotTests {
5657
withTimeout(testTimeout) {
5758
val responseList = responses.toList()
5859
responseList.isEmpty() shouldBe false
59-
responseList.forEach {
60-
it.candidates.first().finishReason shouldBe FinishReason.STOP
61-
it.candidates.first().content.parts.isEmpty() shouldBe false
62-
it.candidates.first().safetyRatings.isEmpty() shouldBe false
60+
responseList.last().candidates.first().apply {
61+
finishReason shouldBe FinishReason.STOP
62+
content.parts.isEmpty() shouldBe false
6363
}
6464
}
6565
}

firebase-ai/src/test/java/com/google/firebase/ai/VertexAIStreamingSnapshotTests.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ internal class VertexAIStreamingSnapshotTests {
5151
withTimeout(testTimeout) {
5252
val responseList = responses.toList()
5353
responseList.isEmpty() shouldBe false
54-
responseList.first().candidates.first().finishReason shouldBe FinishReason.STOP
55-
responseList.first().candidates.first().content.parts.isEmpty() shouldBe false
56-
responseList.first().candidates.first().safetyRatings.isEmpty() shouldBe false
54+
responseList.last().candidates.first().apply {
55+
finishReason shouldBe FinishReason.STOP
56+
content.parts.isEmpty() shouldBe false
57+
safetyRatings.isEmpty() shouldBe false
58+
}
5759
}
5860
}
5961

@@ -65,10 +67,9 @@ internal class VertexAIStreamingSnapshotTests {
6567
withTimeout(testTimeout) {
6668
val responseList = responses.toList()
6769
responseList.isEmpty() shouldBe false
68-
responseList.forEach {
69-
it.candidates.first().finishReason shouldBe FinishReason.STOP
70-
it.candidates.first().content.parts.isEmpty() shouldBe false
71-
it.candidates.first().safetyRatings.isEmpty() shouldBe false
70+
responseList.last().candidates.first().apply {
71+
finishReason shouldBe FinishReason.STOP
72+
content.parts.isEmpty() shouldBe false
7273
}
7374
}
7475
}

firebase-ai/src/test/java/com/google/firebase/ai/util/tests.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import java.io.File
3939
import kotlinx.coroutines.launch
4040
import org.mockito.Mockito
4141

42-
private val TEST_CLIENT_ID = "firebase-vertexai-android/test"
42+
private val TEST_CLIENT_ID = "firebase-ai-android/test"
4343
private val TEST_APP_ID = "1:android:12345"
4444
private val TEST_VERSION = 1
4545

@@ -193,7 +193,7 @@ internal fun goldenDevAPIStreamingFile(
193193
name: String,
194194
httpStatusCode: HttpStatusCode = HttpStatusCode.OK,
195195
block: CommonTest,
196-
) = goldenStreamingFile("vertexai/$name", httpStatusCode, GenerativeBackend.googleAI(), block)
196+
) = goldenStreamingFile("googleai/$name", httpStatusCode, GenerativeBackend.googleAI(), block)
197197

198198
/**
199199
* A variant of [commonTest] for performing snapshot tests.

firebase-ai/update_responses.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
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='v11.*' # The major version of mock responses to use
20+
RESPONSES_VERSION='v13.*' # The major version of mock responses to use
2121
REPO_NAME="vertexai-sdk-test-data"
2222
REPO_LINK="https://github.com/FirebaseExtended/$REPO_NAME.git"
2323

0 commit comments

Comments
 (0)