You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
* from the model. This will be provided to the model for each message sent (as context for the
45
45
* discussion).
46
46
*/
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"""
* Represents a multimodal model (like Gemini), capable of generating content based on various input
48
48
* types.
49
49
*/
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"""
"""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"""
* various input types, supporting bidirectional streaming.
47
47
*/
48
48
@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"""
"""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"""
"""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.
37
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
"""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.
34
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
"""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.
33
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
"""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.
43
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
* @property citationMetadata Metadata about the sources used to generate this content.
35
35
* @property finishReason The reason the model stopped generating content, if it exist.
36
36
*/
37
+
@Deprecated(
38
+
"""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.
39
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
40
+
)
37
41
publicclassCandidate
38
42
internalconstructor(
39
43
publicval content:Content,
@@ -51,7 +55,7 @@ internal constructor(
51
55
valgroundingMetadata:GroundingMetadata? = null,
52
56
) {
53
57
internalfuntoPublic(): Candidate {
54
-
val safetyRatings = safetyRatings?.map { it.toPublic() }.orEmpty()
58
+
val safetyRatings = safetyRatings?.mapNotNull { it.toPublic() }.orEmpty()
55
59
val citations = citationMetadata?.toPublic()
56
60
val finishReason = finishReason?.toPublic()
57
61
@@ -106,6 +110,10 @@ internal constructor(
106
110
* @property severity The severity of the potential harm.
107
111
* @property severityScore A numerical score representing the severity of harm.
108
112
*/
113
+
@Deprecated(
114
+
"""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.
115
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
116
+
)
109
117
publicclassSafetyRating
110
118
internalconstructor(
111
119
publicval category:HarmCategory,
@@ -120,23 +128,32 @@ internal constructor(
120
128
internaldata classInternal
121
129
@JvmOverloads
122
130
constructor(
123
-
val category:HarmCategory.Internal,
124
-
val probability:HarmProbability.Internal,
131
+
val category:HarmCategory.Internal?=null,
132
+
val probability:HarmProbability.Internal?=null,
125
133
val blocked:Boolean?=null, // TODO(): any reason not to default to false?
126
134
val probabilityScore:Float?=null,
127
135
val severity:HarmSeverity.Internal?=null,
128
136
val severityScore:Float?=null,
129
137
) {
130
138
131
139
internalfuntoPublic() =
132
-
SafetyRating(
133
-
category = category.toPublic(),
134
-
probability = probability.toPublic(),
135
-
probabilityScore = probabilityScore ?:0f,
136
-
blocked = blocked,
137
-
severity = severity?.toPublic(),
138
-
severityScore = severityScore
139
-
)
140
+
/**
141
+
* Due to a bug in the backend, it's possible that we receive an invalid `SafetyRating` value,
142
+
* without either category or probability. We return null in those cases to enable filtering
143
+
* by the higher level types.
144
+
*/
145
+
if (category ==null|| probability ==null) {
146
+
null
147
+
} else {
148
+
SafetyRating(
149
+
category = category.toPublic(),
150
+
probability = probability.toPublic(),
151
+
probabilityScore = probabilityScore ?:0f,
152
+
blocked = blocked,
153
+
severity = severity?.toPublic(),
154
+
severityScore = severityScore
155
+
)
156
+
}
140
157
}
141
158
}
142
159
@@ -146,6 +163,10 @@ internal constructor(
146
163
* @property citations A list of individual cited sources and the parts of the content to which they
147
164
* apply.
148
165
*/
166
+
@Deprecated(
167
+
"""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.
168
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
@@ -173,6 +194,10 @@ public class CitationMetadata internal constructor(public val citations: List<Ci
173
194
* @property license The license under which the cited content is distributed under, if available.
174
195
* @property publicationDate The date of publication of the cited source, if available.
175
196
*/
197
+
@Deprecated(
198
+
"""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.
199
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
200
+
)
176
201
publicclassCitation
177
202
internalconstructor(
178
203
publicval title:String?=null,
@@ -239,6 +264,10 @@ internal constructor(
239
264
* @property name The name of the finish reason.
240
265
* @property ordinal The ordinal value of the finish reason.
241
266
*/
267
+
@Deprecated(
268
+
"""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.
269
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
270
+
)
242
271
publicclassFinishReason private constructor(publicvalname:String, public valordinal:Int) {
* @param parts An ordered list of [Part] that constitute this content.
33
33
*/
34
+
@Deprecated(
35
+
"""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.
36
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
37
+
)
34
38
publicclassContent
35
39
@JvmOverloads
36
40
constructor(publicval role:String?="user", public val parts:List<Part>) {
@@ -41,6 +45,10 @@ constructor(public val role: String? = "user", public val parts: List<Part>) {
41
45
}
42
46
43
47
/** Builder class to facilitate constructing complex [Content] objects. */
48
+
@Deprecated(
49
+
"""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.
50
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
51
+
)
44
52
publicclassBuilder {
45
53
46
54
/** The producer of the content. Must be either 'user' or 'model'. By default, it's "user". */
"""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.
27
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
* @property promptTokensDetails The breakdown, by modality, of how many tokens are consumed by the
34
34
* prompt.
35
35
*/
36
+
@Deprecated(
37
+
"""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.
38
+
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
0 commit comments