Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions firebase-vertexai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Unreleased
* [changed] The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK
(firebase-ai) to accommodate the evolving set of supported features and services.

For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk


# 16.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ import kotlinx.coroutines.flow.onEach
* from the model. This will be provided to the model for each message sent (as context for the
* discussion).
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class Chat(
private val model: GenerativeModel,
public val history: MutableList<Content> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ import kotlinx.serialization.ExperimentalSerializationApi
* Represents a multimodal model (like Gemini), capable of generating content based on various input
* types.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class GenerativeModel
internal constructor(
private val modelName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import com.google.firebase.vertexai.type.RequestOptions
* types.
*/
@PublicPreviewAPI
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class ImagenModel
internal constructor(
private val modelName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ import kotlinx.serialization.json.JsonObject
* various input types, supporting bidirectional streaming.
*/
@PublicPreviewAPI
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class LiveGenerativeModel
internal constructor(
private val modelName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import org.reactivestreams.Publisher
*
* @see [Chat]
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public abstract class ChatFutures internal constructor() {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import org.reactivestreams.Publisher
*
* @see [GenerativeModel]
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public abstract class GenerativeModelFutures internal constructor() {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import com.google.firebase.vertexai.type.PublicPreviewAPI
* @see [ImagenModel]
*/
@PublicPreviewAPI
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public abstract class ImagenModelFutures internal constructor() {
/**
* Generates an image, returning the result directly to the caller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import com.google.firebase.vertexai.type.ServiceConnectionHandshakeFailedExcepti
* @see [LiveGenerativeModel]
*/
@PublicPreviewAPI
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public abstract class LiveModelFutures internal constructor() {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ import org.reactivestreams.Publisher
* @see [LiveSession]
*/
@PublicPreviewAPI
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public abstract class LiveSessionFutures internal constructor() {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ import kotlinx.serialization.json.JsonNames
* @property citationMetadata Metadata about the sources used to generate this content.
* @property finishReason The reason the model stopped generating content, if it exist.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class Candidate
internal constructor(
public val content: Content,
Expand All @@ -51,7 +55,7 @@ internal constructor(
val groundingMetadata: GroundingMetadata? = null,
) {
internal fun toPublic(): Candidate {
val safetyRatings = safetyRatings?.map { it.toPublic() }.orEmpty()
val safetyRatings = safetyRatings?.mapNotNull { it.toPublic() }.orEmpty()
val citations = citationMetadata?.toPublic()
val finishReason = finishReason?.toPublic()

Expand Down Expand Up @@ -106,6 +110,10 @@ internal constructor(
* @property severity The severity of the potential harm.
* @property severityScore A numerical score representing the severity of harm.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class SafetyRating
internal constructor(
public val category: HarmCategory,
Expand All @@ -120,23 +128,32 @@ internal constructor(
internal data class Internal
@JvmOverloads
constructor(
val category: HarmCategory.Internal,
val probability: HarmProbability.Internal,
val category: HarmCategory.Internal? = null,
val probability: HarmProbability.Internal? = null,
val blocked: Boolean? = null, // TODO(): any reason not to default to false?
val probabilityScore: Float? = null,
val severity: HarmSeverity.Internal? = null,
val severityScore: Float? = null,
) {

internal fun toPublic() =
SafetyRating(
category = category.toPublic(),
probability = probability.toPublic(),
probabilityScore = probabilityScore ?: 0f,
blocked = blocked,
severity = severity?.toPublic(),
severityScore = severityScore
)
/**
* Due to a bug in the backend, it's possible that we receive an invalid `SafetyRating` value,
* without either category or probability. We return null in those cases to enable filtering
* by the higher level types.
*/
if (category == null || probability == null) {
null
} else {
SafetyRating(
category = category.toPublic(),
probability = probability.toPublic(),
probabilityScore = probabilityScore ?: 0f,
blocked = blocked,
severity = severity?.toPublic(),
severityScore = severityScore
)
}
}
}

Expand All @@ -146,6 +163,10 @@ internal constructor(
* @property citations A list of individual cited sources and the parts of the content to which they
* apply.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class CitationMetadata internal constructor(public val citations: List<Citation>) {

@Serializable
Expand Down Expand Up @@ -173,6 +194,10 @@ public class CitationMetadata internal constructor(public val citations: List<Ci
* @property license The license under which the cited content is distributed under, if available.
* @property publicationDate The date of publication of the cited source, if available.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class Citation
internal constructor(
public val title: String? = null,
Expand Down Expand Up @@ -239,6 +264,10 @@ internal constructor(
* @property name The name of the finish reason.
* @property ordinal The ordinal value of the finish reason.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class FinishReason private constructor(public val name: String, public val ordinal: Int) {

@Serializable(Internal.Serializer::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import kotlinx.serialization.Serializable
* `"user"`.
* @param parts An ordered list of [Part] that constitute this content.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class Content
@JvmOverloads
constructor(public val role: String? = "user", public val parts: List<Part>) {
Expand All @@ -41,6 +45,10 @@ constructor(public val role: String? = "user", public val parts: List<Part>) {
}

/** Builder class to facilitate constructing complex [Content] objects. */
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class Builder {

/** The producer of the content. Must be either 'user' or 'model'. By default, it's "user". */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/** Content part modality. */
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class ContentModality private constructor(public val ordinal: Int) {

@Serializable(Internal.Serializer::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import kotlinx.serialization.Serializable
* @property promptTokensDetails The breakdown, by modality, of how many tokens are consumed by the
* prompt.
*/
@Deprecated(
"""The Firebase VertexAI SDK (firebase-vertexai) has been replaced with the Firebase AI SDK (firebase-ai) to accommodate the evolving set of supported features and services.
For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk"""
)
public class CountTokensResponse(
public val totalTokens: Int,
public val totalBillableCharacters: Int? = null,
Expand Down
Loading
Loading