Skip to content

Commit 4d609dd

Browse files
authored
Merge 18da7b4 into a41af7d
2 parents a41af7d + 18da7b4 commit 4d609dd

File tree

11 files changed

+63
-10
lines changed

11 files changed

+63
-10
lines changed

.github/workflows/ci_tests.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ jobs:
5959
- name: Pull genai-common
6060
if: matrix.module == ':firebase-vertexai'
6161
run: |
62-
git clone https://github.com/google-gemini/generative-ai-android.git
62+
git clone --branch tanzim/nullable https://github.com/google-gemini/generative-ai-android.git
6363
cd generative-ai-android
64-
./gradlew :common:updateVersion common:publishToMavenLocal
64+
./gradlew :common:updateVersion
65+
./gradlew :common:publishToMavenLocal
6566
cd ..
6667
6768
- name: Clone mock responses
@@ -133,6 +134,15 @@ jobs:
133134
distribution: temurin
134135
cache: gradle
135136

137+
- name: Pull genai-common
138+
if: matrix.module == ':firebase-vertexai'
139+
run: |
140+
git clone --branch tanzim/nullable https://github.com/google-gemini/generative-ai-android.git
141+
cd generative-ai-android
142+
./gradlew :common:updateversion
143+
./gradlew :common:publishToMavenLocal
144+
cd ..
145+
136146
- name: Add google-services.json
137147
env:
138148
INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }}

.github/workflows/diff-javadoc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ jobs:
2525
distribution: temurin
2626
cache: gradle
2727

28+
- name: Pull genai-common
29+
run: |
30+
git clone --branch tanzim/nullable https://github.com/google-gemini/generative-ai-android.git
31+
cd generative-ai-android
32+
./gradlew :common:updateversion
33+
./gradlew :common:publishToMavenLocal
34+
cd ..
35+
2836
- name: Generate docs for PR branch
2937
run: ./gradlew kotlindoc
3038

.github/workflows/health-metrics.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ jobs:
6969
java-version: 17
7070
distribution: temurin
7171
cache: gradle
72+
- name: Pull genai-common
73+
run: |
74+
git clone --branch tanzim/nullable https://github.com/google-gemini/generative-ai-android.git
75+
cd generative-ai-android
76+
./gradlew :common:updateversion
77+
./gradlew :common:publishToMavenLocal
78+
cd ..
7279
- name: Set up Python 3.10
7380
uses: actions/setup-python@v4
7481
with:
@@ -105,6 +112,13 @@ jobs:
105112
java-version: 17
106113
distribution: temurin
107114
cache: gradle
115+
- name: Pull genai-common
116+
run: |
117+
git clone --branch tanzim/nullable https://github.com/google-gemini/generative-ai-android.git
118+
cd generative-ai-android
119+
./gradlew :common:updateversion
120+
./gradlew :common:publishToMavenLocal
121+
cd ..
108122
- name: Set up Python 3.10
109123
uses: actions/setup-python@v4
110124
with:

.github/workflows/smoke-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ jobs:
2222
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}
2323
- uses: google-github-actions/setup-gcloud@v2
2424

25+
- name: Pull genai-common
26+
run: |
27+
git clone --branch tanzim/nullable https://github.com/google-gemini/generative-ai-android.git
28+
cd generative-ai-android
29+
./gradlew :common:updateversion
30+
./gradlew :common:publishToMavenLocal
31+
cd ..
32+
2533
# TODO(yifany): make it a fireci plugin and remove the separately distributed jar file
2634
- name: Download smoke tests runner
2735
run: |

firebase-vertexai/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Unreleased
2-
2+
* [changed] Made `FunctionCallPart.args` nullable
33

44
# 16.0.0-beta03
55
* [changed] Breaking Change: changed `Schema.int` to return 32 bit integers instead of 64 bit (long).

firebase-vertexai/firebase-vertexai.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ dependencies {
6161
implementation("com.google.firebase:firebase-components:18.0.0")
6262
implementation("com.google.firebase:firebase-annotations:16.2.0")
6363
implementation("com.google.firebase:firebase-appcheck-interop:17.1.0")
64-
implementation("com.google.ai.client.generativeai:common:0.9.0")
64+
implementation("com.google.ai.client.generativeai:common:0.10.0")
6565
implementation(libs.androidx.annotation)
6666
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
6767
implementation("androidx.core:core-ktx:1.12.0")

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/internal/util/conversions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ internal fun Part.toInternal(): com.google.ai.client.generativeai.common.shared.
8686
)
8787
)
8888
is com.google.firebase.vertexai.type.FunctionCallPart ->
89-
FunctionCallPart(FunctionCall(name, args.orEmpty()))
89+
FunctionCallPart(FunctionCall(name, args))
9090
is com.google.firebase.vertexai.type.FunctionResponsePart ->
9191
FunctionResponsePart(FunctionResponse(name, response.toInternal()))
9292
is FileDataPart ->
@@ -219,7 +219,7 @@ internal fun com.google.ai.client.generativeai.common.shared.Part.toPublic(): Pa
219219
is FunctionCallPart ->
220220
com.google.firebase.vertexai.type.FunctionCallPart(
221221
functionCall.name,
222-
functionCall.args.orEmpty(),
222+
functionCall.args,
223223
)
224224
is FunctionResponsePart ->
225225
com.google.firebase.vertexai.type.FunctionResponsePart(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ fun <T, U, W, Z> defineFunction(
368368
) = FourParameterFunction(name, description, arg1, arg2, arg3, arg4, function)
369369

370370
private fun <T> FunctionCallPart.getArgOrThrow(param: Schema<T>): T {
371-
return param.fromString(args[param.name])
371+
return param.fromString(args?.get(param.name))
372372
?: throw RuntimeException(
373373
"Missing argument for parameter \"${param.name}\" for function \"$name\""
374374
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BlobPart(val mimeType: String, val blob: ByteArray) : Part
4949
* @param name the name of the function to call
5050
* @param args the function parameters and values as a [Map]
5151
*/
52-
class FunctionCallPart(val name: String, val args: Map<String, String?>) : Part
52+
class FunctionCallPart(val name: String, val args: Map<String, String?>?) : Part
5353

5454
/**
5555
* Represents function call output to be returned to the model when it requests a function call.

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ internal class UnarySnapshotTests {
272272
val response = model.generateContent("prompt")
273273
val callPart = (response.candidates.first().content.parts.first() as FunctionCallPart)
274274

275-
callPart.args["season"] shouldBe null
275+
callPart.args!!["seasons"] shouldBe null
276276
}
277277
}
278278

@@ -289,7 +289,19 @@ internal class UnarySnapshotTests {
289289
it.parts.first().shouldBeInstanceOf<FunctionCallPart>()
290290
}
291291

292-
callPart.args["current"] shouldBe "true"
292+
callPart.args!!["current"] shouldBe "true"
293+
}
294+
}
295+
296+
@Test
297+
fun `function call has no arguments field`() =
298+
goldenUnaryFile("success-function-call-empty-arguments.json") {
299+
withTimeout(testTimeout) {
300+
val response = model.generateContent("prompt")
301+
val callPart = response.functionCalls.first()
302+
303+
callPart.name shouldBe "current_time"
304+
callPart.args shouldBe null
293305
}
294306
}
295307
}

0 commit comments

Comments
 (0)