Skip to content

Commit 92e5fc3

Browse files
committed
Merge branch 'main' of https://github.com/firebase/firebase-android-sdk into rpf/fix-content-part-serialization
2 parents cae05b2 + af24598 commit 92e5fc3

File tree

31 files changed

+421
-77
lines changed

31 files changed

+421
-77
lines changed

firebase-ai/CHANGELOG.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Unreleased
2-
* [fixed] **Breaking Change**: Fixed missing builder methods and return types in builders.
3-
* [changed] **Breaking Change**: `LiveModelFutures.connect` now returns `ListenableFuture<LiveSessionFutures>` instead of `ListenableFuture<LiveSession>`.
4-
* **Action Required:** Remove any transformations from LiveSession object to LiveSessionFutures object.
5-
* **Action Required:** Change type of variable handling `LiveModelFutures.connect` to `ListenableFuture<LiveSessionsFutures>`
6-
* [changed] **Breaking Change**: Removed `UNSPECIFIED` value for enum class `ResponseModality`
7-
* **Action Required:** Remove all references to `ResponseModality.UNSPECIFIED`
8-
* [changed] **Breaking Change**: Renamed `LiveGenerationConfig.setResponseModalities` to `LiveGenerationConfig.setResponseModality`
9-
* **Action Required:** Replace all references of `LiveGenerationConfig.setResponseModalities` with `LiveGenerationConfig.setResponseModality`
10-
* [feature] Added support for `HarmBlockThreshold.OFF`. See the
11-
[model documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters#how_to_configure_content_filters){: .external}
12-
for more information.
13-
* [fixed] Improved thread usage when using a `LiveGenerativeModel`. (#6870)
14-
* [fixed] Fixed an issue with `LiveContentResponse` audio data not being present when the model was
15-
interrupted or the turn completed. (#6870)
16-
* [fixed] Fixed an issue with `LiveSession` not converting exceptions to `FirebaseVertexAIException`. (#6870)
17-
* * [changed] **Breaking Change**: Removed the `LiveContentResponse.Status` class, and instead have nested the status
18-
fields as properties of `LiveContentResponse`. (#6906)
19-
* [changed] **Breaking Change**: Removed the `LiveContentResponse` class, and instead have provided subclasses
20-
of `LiveServerMessage` that match the responses from the model. (#6910)
21-
* [feature] Added support for the `id` field on `FunctionResponsePart` and `FunctionCallPart`. (#6910)
22-
* [feature] Add support for specifying response modalities in `GenerationConfig`. (#6921)
23-
* [feature] Added a helper field for getting all the `InlineDataPart` from a `GenerateContentResponse`. (#6922)
2+
3+
* [fixed] Fixed `FirebaseAI.getInstance` StackOverflowException (#6971)
4+
* [fixed] Fixed an issue that was causing the SDK to send empty `FunctionDeclaration` descriptions to the API.
5+
* [changed] Introduced the `Voice` class, which accepts a voice name, and deprecated the `Voices` class.
6+
* [changed] **Breaking Change**: Updated `SpeechConfig` to take in `Voice` class instead of `Voices` class.
7+
* **Action Required:** Update all references of `SpeechConfig` initialization to use `Voice` class.
8+
9+
10+
# 16.0.0
11+
* [feature] Initial release of the Firebase AI SDK (`firebase-ai`). This SDK *replaces* the previous
12+
Vertex AI in Firebase SDK (`firebase-vertexai`) to accommodate the evolving set of supported
13+
features and services.
14+
* The new Firebase AI SDK provides **Preview** support for the Gemini Developer API, including its
15+
free tier offering.
16+
* Using the Firebase AI SDK with the Vertex AI Gemini API is still generally available (GA).
17+
18+
If you're using the old `firebase-vertexai`, we recommend
19+
[migrating to `firebase-ai`](/docs/ai-logic/migrate-to-latest-sdk)
20+
because all new development and features will be in this new SDK.
21+
* [feature] **Preview:** Added support for specifying response modalities in `GenerationConfig`
22+
(only available in the new `firebase-ai` package). This includes support for image generation using
23+
[specific Gemini models](/docs/vertex-ai/models).
24+
25+
Note: This feature is in Public Preview, which means that it is not subject to any SLA or
26+
deprecation policy and could change in backwards-incompatible ways.
2427

firebase-ai/api.txt

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,9 @@ package com.google.firebase.ai.type {
863863
}
864864

865865
@com.google.firebase.ai.type.PublicPreviewAPI public final class SpeechConfig {
866-
ctor public SpeechConfig(com.google.firebase.ai.type.Voices voice);
867-
method public com.google.firebase.ai.type.Voices getVoice();
868-
property public final com.google.firebase.ai.type.Voices voice;
866+
ctor public SpeechConfig(com.google.firebase.ai.type.Voice voice);
867+
method public com.google.firebase.ai.type.Voice getVoice();
868+
property public final com.google.firebase.ai.type.Voice voice;
869869
}
870870

871871
public abstract class StringFormat {
@@ -914,19 +914,25 @@ package com.google.firebase.ai.type {
914914
property public final int totalTokenCount;
915915
}
916916

917-
@com.google.firebase.ai.type.PublicPreviewAPI public final class Voices {
918-
method public int getOrdinal();
919-
property public final int ordinal;
920-
field public static final com.google.firebase.ai.type.Voices AOEDE;
921-
field public static final com.google.firebase.ai.type.Voices CHARON;
922-
field public static final com.google.firebase.ai.type.Voices.Companion Companion;
923-
field public static final com.google.firebase.ai.type.Voices FENRIR;
924-
field public static final com.google.firebase.ai.type.Voices KORE;
925-
field public static final com.google.firebase.ai.type.Voices PUCK;
926-
field public static final com.google.firebase.ai.type.Voices UNSPECIFIED;
917+
@com.google.firebase.ai.type.PublicPreviewAPI public final class Voice {
918+
ctor public Voice(String voiceName);
919+
method public String getVoiceName();
920+
property public final String voiceName;
921+
}
922+
923+
@Deprecated @com.google.firebase.ai.type.PublicPreviewAPI public final class Voices {
924+
method @Deprecated public int getOrdinal();
925+
property @Deprecated public final int ordinal;
926+
field @Deprecated public static final com.google.firebase.ai.type.Voices AOEDE;
927+
field @Deprecated public static final com.google.firebase.ai.type.Voices CHARON;
928+
field @Deprecated public static final com.google.firebase.ai.type.Voices.Companion Companion;
929+
field @Deprecated public static final com.google.firebase.ai.type.Voices FENRIR;
930+
field @Deprecated public static final com.google.firebase.ai.type.Voices KORE;
931+
field @Deprecated public static final com.google.firebase.ai.type.Voices PUCK;
932+
field @Deprecated public static final com.google.firebase.ai.type.Voices UNSPECIFIED;
927933
}
928934

929-
public static final class Voices.Companion {
935+
@Deprecated public static final class Voices.Companion {
930936
}
931937

932938
}

firebase-ai/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=16.0.0
16-
latestReleasedVersion=
15+
version=16.1.0
16+
latestReleasedVersion=16.0.0

firebase-ai/src/main/kotlin/com/google/firebase/ai/FirebaseAI.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ internal constructor(
220220
}
221221

222222
/** The [FirebaseAI] instance for the provided [FirebaseApp] using the Google AI Backend. */
223-
@JvmStatic public fun getInstance(app: FirebaseApp): FirebaseAI = getInstance(app)
223+
@JvmStatic
224+
public fun getInstance(app: FirebaseApp): FirebaseAI =
225+
getInstance(app, GenerativeBackend.googleAI())
224226

225227
private const val GEMINI_MODEL_NAME_PREFIX = "gemini-"
226228

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/FunctionDeclaration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class FunctionDeclaration(
6161
internal val schema: Schema =
6262
Schema.obj(properties = parameters, optionalProperties = optionalParameters, nullable = false)
6363

64-
internal fun toInternal() = Internal(name, "", schema.toInternal())
64+
internal fun toInternal() = Internal(name, description, schema.toInternal())
6565

6666
@Serializable
6767
internal data class Internal(

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenPersonFilterLevel.kt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,30 @@ package com.google.firebase.ai.type
2020
@PublicPreviewAPI
2121
public class ImagenPersonFilterLevel private constructor(internal val internalVal: String) {
2222
public companion object {
23-
/** No filters applied. */
23+
/**
24+
* Allow generation of images containing people of all ages.
25+
*
26+
* > Important: Generation of images containing people or faces may require your use case to be
27+
* reviewed and approved by Cloud support; see the
28+
* [Responsible AI and usage
29+
* guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen)
30+
* for more details.
31+
*/
2432
@JvmField public val ALLOW_ALL: ImagenPersonFilterLevel = ImagenPersonFilterLevel("allow_all")
25-
/** Filters out any images containing depictions of children. */
33+
/**
34+
* Allow generation of images containing adults only; images of children are filtered out.
35+
*
36+
* > Important: Generation of images containing people or faces may require your use case to be
37+
* reviewed and approved by Cloud support; see the
38+
* [Responsible AI and usage
39+
* guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen)
40+
* for more details.
41+
*/
2642
@JvmField
2743
public val ALLOW_ADULT: ImagenPersonFilterLevel = ImagenPersonFilterLevel("allow_adult")
28-
/** Filters out any images containing depictions of people. */
44+
/**
45+
* Disallow generation of images containing people or faces; images of people are filtered out.
46+
*/
2947
@JvmField public val BLOCK_ALL: ImagenPersonFilterLevel = ImagenPersonFilterLevel("dont_allow")
3048
}
3149
}

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/SpeechConfig.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import kotlinx.serialization.Serializable
2323
@PublicPreviewAPI
2424
public class SpeechConfig(
2525
/** The voice to be used for the server's speech response. */
26-
public val voice: Voices
26+
public val voice: Voice
2727
) {
2828

2929
@Serializable
3030
internal data class Internal(@SerialName("voice_config") val voiceConfig: VoiceConfigInternal) {
3131
@Serializable
3232
internal data class VoiceConfigInternal(
33-
@SerialName("prebuilt_voice_config") val prebuiltVoiceConfig: Voices.Internal,
33+
@SerialName("prebuilt_voice_config") val prebuiltVoiceConfig: Voice.Internal,
3434
)
3535
}
3636

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.firebase.ai.type
18+
19+
import kotlinx.serialization.SerialName
20+
import kotlinx.serialization.Serializable
21+
22+
/**
23+
* Various voices supported by the server. The list of all voices can be found
24+
* [here](https://cloud.google.com/text-to-speech/docs/chirp3-hd)
25+
*/
26+
@PublicPreviewAPI
27+
public class Voice public constructor(public val voiceName: String) {
28+
29+
@Serializable internal data class Internal(@SerialName("voice_name") val voiceName: String)
30+
31+
internal fun toInternal(): Internal {
32+
return Internal(this.voiceName)
33+
}
34+
}

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Voices.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import kotlinx.serialization.SerialName
2020
import kotlinx.serialization.Serializable
2121

2222
/** Various voices supported by the server */
23+
@Deprecated("Please use the Voice class instead.", ReplaceWith("Voice"))
2324
@PublicPreviewAPI
2425
public class Voices private constructor(public val ordinal: Int) {
2526

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.firebase.ai.type
18+
19+
import io.kotest.assertions.json.shouldEqualJson
20+
import kotlinx.serialization.encodeToString
21+
import kotlinx.serialization.json.Json
22+
import org.junit.Test
23+
24+
internal class FunctionDeclarationTest {
25+
26+
@Test
27+
fun `Basic FunctionDeclaration with name, description and parameters`() {
28+
val functionDeclaration =
29+
FunctionDeclaration(
30+
name = "isUserAGoat",
31+
description = "Determine if the user is subject to teleportations.",
32+
parameters = mapOf("userID" to Schema.string("ID of the User making the call"))
33+
)
34+
35+
val expectedJson =
36+
"""
37+
{
38+
"name": "isUserAGoat",
39+
"description": "Determine if the user is subject to teleportations.",
40+
"parameters": {
41+
"type": "OBJECT",
42+
"properties": {
43+
"userID": {
44+
"type": "STRING",
45+
"description": "ID of the User making the call"
46+
}
47+
},
48+
"required": [
49+
"userID"
50+
]
51+
}
52+
}
53+
"""
54+
.trimIndent()
55+
56+
Json.encodeToString(functionDeclaration.toInternal()).shouldEqualJson(expectedJson)
57+
}
58+
59+
@Test
60+
fun `FunctionDeclaration with optional parameters`() {
61+
val functionDeclaration =
62+
FunctionDeclaration(
63+
name = "isUserAGoat",
64+
description = "Determine if the user is subject to teleportations.",
65+
parameters =
66+
mapOf(
67+
"userID" to Schema.string("ID of the user making the call"),
68+
"userName" to Schema.string("Name of the user making the call")
69+
),
70+
optionalParameters = listOf("userName")
71+
)
72+
73+
val expectedJson =
74+
"""
75+
{
76+
"name": "isUserAGoat",
77+
"description": "Determine if the user is subject to teleportations.",
78+
"parameters": {
79+
"type": "OBJECT",
80+
"properties": {
81+
"userID": {
82+
"type": "STRING",
83+
"description": "ID of the user making the call"
84+
},
85+
"userName": {
86+
"type": "STRING",
87+
"description": "Name of the user making the call"
88+
}
89+
},
90+
"required": [
91+
"userID"
92+
]
93+
}
94+
}
95+
"""
96+
.trimIndent()
97+
98+
Json.encodeToString(functionDeclaration.toInternal()).shouldEqualJson(expectedJson)
99+
}
100+
}

firebase-ai/src/testUtil/java/com/google/firebase/ai/JavaCompileTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
import com.google.firebase.ai.type.SpeechConfig;
6262
import com.google.firebase.ai.type.TextPart;
6363
import com.google.firebase.ai.type.UsageMetadata;
64-
import com.google.firebase.ai.type.Voices;
64+
import com.google.firebase.ai.type.Voice;
6565
import com.google.firebase.concurrent.FirebaseExecutors;
6666
import java.util.ArrayList;
6767
import java.util.Calendar;
@@ -137,7 +137,7 @@ private LiveGenerationConfig getLiveConfig() {
137137
.setFrequencyPenalty(1.0F)
138138
.setPresencePenalty(2.0F)
139139
.setResponseModality(ResponseModality.AUDIO)
140-
.setSpeechConfig(new SpeechConfig(Voices.AOEDE))
140+
.setSpeechConfig(new SpeechConfig(new Voice("AOEDE")))
141141
.build();
142142
}
143143

firebase-config/CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Unreleased
2-
* [fixed] Fixed `NetworkOnMainThreadException` on Android versions below 8 by disconnecting HttpURLConnection only on API levels 26 and higher.
2+
3+
4+
# 22.1.2
5+
* [fixed] Fixed `NetworkOnMainThreadException` on Android versions below 8 by disconnecting
6+
`HttpURLConnection` only on API levels 26 and higher. GitHub Issue [#6934]
7+
8+
9+
## Kotlin
10+
The Kotlin extensions library transitively includes the updated
11+
`firebase-config` library. The Kotlin extensions library has no additional
12+
updates.
313

414
# 22.1.1
515
* [fixed] Fixed an issue where the connection to the real-time Remote Config backend could remain

firebase-config/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
version=22.1.2
18-
latestReleasedVersion=22.1.1
17+
version=22.1.3
18+
latestReleasedVersion=22.1.2
1919
android.enableUnitTestBinaryResources=true
2020

firebase-dataconnect/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Unreleased
2-
* [changed] Code robustness improvements related to state management in
2+
3+
4+
# 16.0.2
5+
* [changed] Improved code robustness related to state management in
36
`FirebaseDataConnect` objects.
47
([#6861](https://github.com/firebase/firebase-android-sdk/pull/6861))
58

6-
79
# 16.0.1
810
* [changed] Internal improvements.
911

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=16.0.2
2-
latestReleasedVersion=16.0.1
1+
version=16.0.3
2+
latestReleasedVersion=16.0.2

0 commit comments

Comments
 (0)