Skip to content

Commit 7b1855d

Browse files
daymxnrlazo
andauthored
Prepare VertexAI SDK for release (#6941)
Per [b/414829218](https://b.corp.google.com/issues/414829218), This ensures the Vertex AI SDK is properly aligned for the upcoming release. More specifically, this PR does the following: - Adds deprecation notices for all the public classes and interfaces, **besides** the root `FirebaseVertexAI` class and the relevant extension methods. - Updates the golden file version. - Adds the change from #6925 for working around invalid `SafetyRating`(s). - Adds a changelog entry that aligns with the deprecation notices. - Adds the changes from #6939 for tracking bidi usage. - Adds the changes from #6910 for aligning the bidi protos. --------- Co-authored-by: Rodrigo Lazo <[email protected]>
1 parent 548dc28 commit 7b1855d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1415
-918
lines changed

firebase-vertexai/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
# Unreleased
2+
* [changed] **Renamed / Replaced:** Vertex AI in Firebase (`FirebaseVertexAI`) has been renamed and
3+
replaced by the new Firebase AI SDK: `FirebaseAI`. This is to accommodate the evolving set of
4+
supported features and services. Please migrate to the new `FirebaseAI` package. See details in the
5+
[migration guide](/docs/vertex-ai/migrate-to-latest-sdk).
6+
7+
Note: Existing Vertex AI in Firebase users may continue to use the SDK and receive bug fixes but,
8+
going forward, new features will only be added into the new Firebase AI SDK.
9+
* [changed] **Breaking Change**: Removed the `LiveContentResponse.Status` class, and instead have nested the status
10+
fields as properties of `LiveContentResponse`. (#6941)
11+
* [changed] **Breaking Change**: Removed the `LiveContentResponse` class, and instead have provided subclasses
12+
of `LiveServerMessage` that match the responses from the model. (#6941)
13+
* [feature] Added support for the `id` field on `FunctionResponsePart` and `FunctionCallPart`. (#6941)
14+
* [feature] Added a helper field for getting all the `InlineDataPart` from a `GenerateContentResponse`. (#6941)
215

316

417
# 16.4.0

firebase-vertexai/api.txt

Lines changed: 703 additions & 679 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ import kotlinx.coroutines.flow.onEach
4444
* from the model. This will be provided to the model for each message sent (as context for the
4545
* discussion).
4646
*/
47+
@Deprecated(
48+
"""The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
49+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
50+
)
4751
public class Chat(
4852
private val model: GenerativeModel,
4953
public val history: MutableList<Content> = ArrayList()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import com.google.firebase.vertexai.type.Tool
3737
import com.google.firebase.vertexai.type.ToolConfig
3838
import kotlin.coroutines.CoroutineContext
3939

40-
/** Entry point for all _Vertex AI for Firebase_ functionality. */
40+
/** Entry point for all _Vertex AI in Firebase_ functionality. */
4141
public class FirebaseVertexAI
4242
internal constructor(
4343
private val firebaseApp: FirebaseApp,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import com.google.firebase.inject.Provider
2525
import kotlin.coroutines.CoroutineContext
2626

2727
/**
28-
* Multi-resource container for Firebase Vertex AI.
28+
* Multi-resource container for Vertex AI in Firebase.
2929
*
3030
* @hide
3131
*/

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ import kotlinx.serialization.ExperimentalSerializationApi
4747
* Represents a multimodal model (like Gemini), capable of generating content based on various input
4848
* types.
4949
*/
50+
@Deprecated(
51+
"""The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
52+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
53+
)
5054
public class GenerativeModel
5155
internal constructor(
5256
private val modelName: String,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ import com.google.firebase.vertexai.type.RequestOptions
3636
* types.
3737
*/
3838
@PublicPreviewAPI
39+
@Deprecated(
40+
"""The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
41+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
42+
)
3943
public class ImagenModel
4044
internal constructor(
4145
private val modelName: String,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ import kotlinx.serialization.json.JsonObject
4646
* various input types, supporting bidirectional streaming.
4747
*/
4848
@PublicPreviewAPI
49+
@Deprecated(
50+
"""The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
51+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
52+
)
4953
public class LiveGenerativeModel
5054
internal constructor(
5155
private val modelName: String,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ internal constructor(
164164
"wss://firebasevertexai.googleapis.com/ws/google.firebase.vertexai.v1beta.LlmBidiService/BidiGenerateContent/locations/$location?key=$key"
165165

166166
suspend fun getWebSocketSession(location: String): ClientWebSocketSession =
167-
client.webSocketSession(getBidiEndpoint(location))
167+
client.webSocketSession(getBidiEndpoint(location)) { applyCommonHeaders() }
168168

169169
fun generateContentStream(
170170
request: GenerateContentRequest
@@ -197,6 +197,11 @@ internal constructor(
197197
is CountTokensRequest -> setBody<CountTokensRequest>(request)
198198
is GenerateImageRequest -> setBody<GenerateImageRequest>(request)
199199
}
200+
201+
applyCommonHeaders()
202+
}
203+
204+
private fun HttpRequestBuilder.applyCommonHeaders() {
200205
contentType(ContentType.Application.Json)
201206
header("x-goog-api-key", key)
202207
header("x-goog-api-client", apiClient)

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ import org.reactivestreams.Publisher
3030
*
3131
* @see [Chat]
3232
*/
33+
@Deprecated(
34+
"""The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
35+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
36+
)
3337
public abstract class ChatFutures internal constructor() {
3438

3539
/**

0 commit comments

Comments
 (0)