diff --git a/firebase-vertexai/CHANGELOG.md b/firebase-vertexai/CHANGELOG.md index 75622f2027c..3f38d8620e2 100644 --- a/firebase-vertexai/CHANGELOG.md +++ b/firebase-vertexai/CHANGELOG.md @@ -1,4 +1,17 @@ # Unreleased +* [changed] **Renamed / Replaced:** Vertex AI in Firebase (`FirebaseVertexAI`) has been renamed and + replaced by the new Firebase AI SDK: `FirebaseAI`. This is to accommodate the evolving set of + supported features and services. Please migrate to the new `FirebaseAI` package. See details in the + [migration guide](/docs/vertex-ai/migrate-to-latest-sdk). + + Note: Existing Vertex AI in Firebase users may continue to use the SDK and receive bug fixes but, + going forward, new features will only be added into the new Firebase AI SDK. +* [changed] **Breaking Change**: Removed the `LiveContentResponse.Status` class, and instead have nested the status + fields as properties of `LiveContentResponse`. (#6941) +* [changed] **Breaking Change**: Removed the `LiveContentResponse` class, and instead have provided subclasses + of `LiveServerMessage` that match the responses from the model. (#6941) +* [feature] Added support for the `id` field on `FunctionResponsePart` and `FunctionCallPart`. (#6941) +* [feature] Added a helper field for getting all the `InlineDataPart` from a `GenerateContentResponse`. (#6941) # 16.4.0 diff --git a/firebase-vertexai/api.txt b/firebase-vertexai/api.txt index dac472f2a0c..98559ca3abb 100644 --- a/firebase-vertexai/api.txt +++ b/firebase-vertexai/api.txt @@ -1,16 +1,16 @@ // Signature format: 3.0 package com.google.firebase.vertexai { - public final class Chat { - ctor public Chat(com.google.firebase.vertexai.GenerativeModel model, java.util.List history = java.util.ArrayList()); - method public java.util.List getHistory(); - method public suspend Object? sendMessage(android.graphics.Bitmap prompt, kotlin.coroutines.Continuation); - method public suspend Object? sendMessage(com.google.firebase.vertexai.type.Content prompt, kotlin.coroutines.Continuation); - method public suspend Object? sendMessage(String prompt, kotlin.coroutines.Continuation); - method public kotlinx.coroutines.flow.Flow sendMessageStream(android.graphics.Bitmap prompt); - method public kotlinx.coroutines.flow.Flow sendMessageStream(com.google.firebase.vertexai.type.Content prompt); - method public kotlinx.coroutines.flow.Flow sendMessageStream(String prompt); - property public final java.util.List history; + @Deprecated public final class Chat { + ctor @Deprecated public Chat(com.google.firebase.vertexai.GenerativeModel model, java.util.List history = java.util.ArrayList()); + method @Deprecated public java.util.List getHistory(); + method @Deprecated public suspend Object? sendMessage(android.graphics.Bitmap prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? sendMessage(com.google.firebase.vertexai.type.Content prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? sendMessage(String prompt, kotlin.coroutines.Continuation); + method @Deprecated public kotlinx.coroutines.flow.Flow sendMessageStream(android.graphics.Bitmap prompt); + method @Deprecated public kotlinx.coroutines.flow.Flow sendMessageStream(com.google.firebase.vertexai.type.Content prompt); + method @Deprecated public kotlinx.coroutines.flow.Flow sendMessageStream(String prompt); + property @Deprecated public final java.util.List history; } public final class FirebaseVertexAI { @@ -51,599 +51,623 @@ package com.google.firebase.vertexai { method public static com.google.firebase.vertexai.FirebaseVertexAI vertexAI(com.google.firebase.Firebase, com.google.firebase.FirebaseApp app = Firebase.app, String location = "us-central1"); } - public final class GenerativeModel { - method public suspend Object? countTokens(android.graphics.Bitmap prompt, kotlin.coroutines.Continuation); - method public suspend Object? countTokens(com.google.firebase.vertexai.type.Content[] prompt, kotlin.coroutines.Continuation); - method public suspend Object? countTokens(String prompt, kotlin.coroutines.Continuation); - method public suspend Object? generateContent(android.graphics.Bitmap prompt, kotlin.coroutines.Continuation); - method public suspend Object? generateContent(com.google.firebase.vertexai.type.Content[] prompt, kotlin.coroutines.Continuation); - method public suspend Object? generateContent(String prompt, kotlin.coroutines.Continuation); - method public kotlinx.coroutines.flow.Flow generateContentStream(android.graphics.Bitmap prompt); - method public kotlinx.coroutines.flow.Flow generateContentStream(com.google.firebase.vertexai.type.Content... prompt); - method public kotlinx.coroutines.flow.Flow generateContentStream(String prompt); - method public com.google.firebase.vertexai.Chat startChat(java.util.List history = emptyList()); + @Deprecated public final class GenerativeModel { + method @Deprecated public suspend Object? countTokens(android.graphics.Bitmap prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? countTokens(com.google.firebase.vertexai.type.Content[] prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? countTokens(String prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? generateContent(android.graphics.Bitmap prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? generateContent(com.google.firebase.vertexai.type.Content[] prompt, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? generateContent(String prompt, kotlin.coroutines.Continuation); + method @Deprecated public kotlinx.coroutines.flow.Flow generateContentStream(android.graphics.Bitmap prompt); + method @Deprecated public kotlinx.coroutines.flow.Flow generateContentStream(com.google.firebase.vertexai.type.Content... prompt); + method @Deprecated public kotlinx.coroutines.flow.Flow generateContentStream(String prompt); + method @Deprecated public com.google.firebase.vertexai.Chat startChat(java.util.List history = emptyList()); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenModel { - method public suspend Object? generateImages(String prompt, kotlin.coroutines.Continuation>); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenModel { + method @Deprecated public suspend Object? generateImages(String prompt, kotlin.coroutines.Continuation>); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveGenerativeModel { - method public suspend Object? connect(kotlin.coroutines.Continuation); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveGenerativeModel { + method @Deprecated public suspend Object? connect(kotlin.coroutines.Continuation); } } package com.google.firebase.vertexai.java { - public abstract class ChatFutures { - method public static final com.google.firebase.vertexai.java.ChatFutures from(com.google.firebase.vertexai.Chat chat); - method public abstract com.google.firebase.vertexai.Chat getChat(); - method public abstract com.google.common.util.concurrent.ListenableFuture sendMessage(com.google.firebase.vertexai.type.Content prompt); - method public abstract org.reactivestreams.Publisher sendMessageStream(com.google.firebase.vertexai.type.Content prompt); - field public static final com.google.firebase.vertexai.java.ChatFutures.Companion Companion; + @Deprecated public abstract class ChatFutures { + method @Deprecated public static final com.google.firebase.vertexai.java.ChatFutures from(com.google.firebase.vertexai.Chat chat); + method @Deprecated public abstract com.google.firebase.vertexai.Chat getChat(); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture sendMessage(com.google.firebase.vertexai.type.Content prompt); + method @Deprecated public abstract org.reactivestreams.Publisher sendMessageStream(com.google.firebase.vertexai.type.Content prompt); + field @Deprecated public static final com.google.firebase.vertexai.java.ChatFutures.Companion Companion; } - public static final class ChatFutures.Companion { - method public com.google.firebase.vertexai.java.ChatFutures from(com.google.firebase.vertexai.Chat chat); + @Deprecated public static final class ChatFutures.Companion { + method @Deprecated public com.google.firebase.vertexai.java.ChatFutures from(com.google.firebase.vertexai.Chat chat); } - public abstract class GenerativeModelFutures { - method public abstract com.google.common.util.concurrent.ListenableFuture countTokens(com.google.firebase.vertexai.type.Content... prompt); - method public static final com.google.firebase.vertexai.java.GenerativeModelFutures from(com.google.firebase.vertexai.GenerativeModel model); - method public abstract com.google.common.util.concurrent.ListenableFuture generateContent(com.google.firebase.vertexai.type.Content... prompt); - method public abstract org.reactivestreams.Publisher generateContentStream(com.google.firebase.vertexai.type.Content... prompt); - method public abstract com.google.firebase.vertexai.GenerativeModel getGenerativeModel(); - method public abstract com.google.firebase.vertexai.java.ChatFutures startChat(); - method public abstract com.google.firebase.vertexai.java.ChatFutures startChat(java.util.List history); - field public static final com.google.firebase.vertexai.java.GenerativeModelFutures.Companion Companion; + @Deprecated public abstract class GenerativeModelFutures { + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture countTokens(com.google.firebase.vertexai.type.Content... prompt); + method @Deprecated public static final com.google.firebase.vertexai.java.GenerativeModelFutures from(com.google.firebase.vertexai.GenerativeModel model); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture generateContent(com.google.firebase.vertexai.type.Content... prompt); + method @Deprecated public abstract org.reactivestreams.Publisher generateContentStream(com.google.firebase.vertexai.type.Content... prompt); + method @Deprecated public abstract com.google.firebase.vertexai.GenerativeModel getGenerativeModel(); + method @Deprecated public abstract com.google.firebase.vertexai.java.ChatFutures startChat(); + method @Deprecated public abstract com.google.firebase.vertexai.java.ChatFutures startChat(java.util.List history); + field @Deprecated public static final com.google.firebase.vertexai.java.GenerativeModelFutures.Companion Companion; } - public static final class GenerativeModelFutures.Companion { - method public com.google.firebase.vertexai.java.GenerativeModelFutures from(com.google.firebase.vertexai.GenerativeModel model); + @Deprecated public static final class GenerativeModelFutures.Companion { + method @Deprecated public com.google.firebase.vertexai.java.GenerativeModelFutures from(com.google.firebase.vertexai.GenerativeModel model); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public abstract class ImagenModelFutures { - method public static final com.google.firebase.vertexai.java.ImagenModelFutures from(com.google.firebase.vertexai.ImagenModel model); - method public abstract com.google.common.util.concurrent.ListenableFuture> generateImages(String prompt); - method public abstract com.google.firebase.vertexai.ImagenModel getImageModel(); - field public static final com.google.firebase.vertexai.java.ImagenModelFutures.Companion Companion; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public abstract class ImagenModelFutures { + method @Deprecated public static final com.google.firebase.vertexai.java.ImagenModelFutures from(com.google.firebase.vertexai.ImagenModel model); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture> generateImages(String prompt); + method @Deprecated public abstract com.google.firebase.vertexai.ImagenModel getImageModel(); + field @Deprecated public static final com.google.firebase.vertexai.java.ImagenModelFutures.Companion Companion; } - public static final class ImagenModelFutures.Companion { - method public com.google.firebase.vertexai.java.ImagenModelFutures from(com.google.firebase.vertexai.ImagenModel model); + @Deprecated public static final class ImagenModelFutures.Companion { + method @Deprecated public com.google.firebase.vertexai.java.ImagenModelFutures from(com.google.firebase.vertexai.ImagenModel model); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public abstract class LiveModelFutures { - method public abstract com.google.common.util.concurrent.ListenableFuture connect(); - method public static final com.google.firebase.vertexai.java.LiveModelFutures from(com.google.firebase.vertexai.LiveGenerativeModel model); - field public static final com.google.firebase.vertexai.java.LiveModelFutures.Companion Companion; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public abstract class LiveModelFutures { + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture connect(); + method @Deprecated public static final com.google.firebase.vertexai.java.LiveModelFutures from(com.google.firebase.vertexai.LiveGenerativeModel model); + field @Deprecated public static final com.google.firebase.vertexai.java.LiveModelFutures.Companion Companion; } - public static final class LiveModelFutures.Companion { - method public com.google.firebase.vertexai.java.LiveModelFutures from(com.google.firebase.vertexai.LiveGenerativeModel model); + @Deprecated public static final class LiveModelFutures.Companion { + method @Deprecated public com.google.firebase.vertexai.java.LiveModelFutures from(com.google.firebase.vertexai.LiveGenerativeModel model); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public abstract class LiveSessionFutures { - method public abstract com.google.common.util.concurrent.ListenableFuture close(); - method public static final com.google.firebase.vertexai.java.LiveSessionFutures from(com.google.firebase.vertexai.type.LiveSession session); - method public abstract org.reactivestreams.Publisher receive(); - method public abstract com.google.common.util.concurrent.ListenableFuture send(com.google.firebase.vertexai.type.Content content); - method public abstract com.google.common.util.concurrent.ListenableFuture send(String text); - method public abstract com.google.common.util.concurrent.ListenableFuture sendFunctionResponse(java.util.List functionList); - method public abstract com.google.common.util.concurrent.ListenableFuture sendMediaStream(java.util.List mediaChunks); - method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture startAudioConversation(); - method public abstract com.google.common.util.concurrent.ListenableFuture startAudioConversation(kotlin.jvm.functions.Function1? functionCallHandler); - method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture stopAudioConversation(); - method public abstract void stopReceiving(); - field public static final com.google.firebase.vertexai.java.LiveSessionFutures.Companion Companion; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public abstract class LiveSessionFutures { + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture close(); + method @Deprecated public static final com.google.firebase.vertexai.java.LiveSessionFutures from(com.google.firebase.vertexai.type.LiveSession session); + method @Deprecated public abstract org.reactivestreams.Publisher receive(); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture send(com.google.firebase.vertexai.type.Content content); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture send(String text); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture sendFunctionResponse(java.util.List functionList); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture sendMediaStream(java.util.List mediaChunks); + method @Deprecated @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture startAudioConversation(); + method @Deprecated public abstract com.google.common.util.concurrent.ListenableFuture startAudioConversation(kotlin.jvm.functions.Function1? functionCallHandler); + method @Deprecated @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public abstract com.google.common.util.concurrent.ListenableFuture stopAudioConversation(); + method @Deprecated public abstract void stopReceiving(); + field @Deprecated public static final com.google.firebase.vertexai.java.LiveSessionFutures.Companion Companion; } - public static final class LiveSessionFutures.Companion { - method public com.google.firebase.vertexai.java.LiveSessionFutures from(com.google.firebase.vertexai.type.LiveSession session); + @Deprecated public static final class LiveSessionFutures.Companion { + method @Deprecated public com.google.firebase.vertexai.java.LiveSessionFutures from(com.google.firebase.vertexai.type.LiveSession session); } } package com.google.firebase.vertexai.type { - public final class AudioRecordInitializationFailedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - ctor public AudioRecordInitializationFailedException(String message); - } - - public final class BlockReason { - method public String getName(); - method public int getOrdinal(); - property public final String name; - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.BlockReason BLOCKLIST; - field public static final com.google.firebase.vertexai.type.BlockReason.Companion Companion; - field public static final com.google.firebase.vertexai.type.BlockReason OTHER; - field public static final com.google.firebase.vertexai.type.BlockReason PROHIBITED_CONTENT; - field public static final com.google.firebase.vertexai.type.BlockReason SAFETY; - field public static final com.google.firebase.vertexai.type.BlockReason UNKNOWN; - } - - public static final class BlockReason.Companion { - } - - public final class Candidate { - method public com.google.firebase.vertexai.type.CitationMetadata? getCitationMetadata(); - method public com.google.firebase.vertexai.type.Content getContent(); - method public com.google.firebase.vertexai.type.FinishReason? getFinishReason(); - method public java.util.List getSafetyRatings(); - property public final com.google.firebase.vertexai.type.CitationMetadata? citationMetadata; - property public final com.google.firebase.vertexai.type.Content content; - property public final com.google.firebase.vertexai.type.FinishReason? finishReason; - property public final java.util.List safetyRatings; - } - - public final class Citation { - method public int getEndIndex(); - method public String? getLicense(); - method public java.util.Calendar? getPublicationDate(); - method public int getStartIndex(); - method public String? getTitle(); - method public String? getUri(); - property public final int endIndex; - property public final String? license; - property public final java.util.Calendar? publicationDate; - property public final int startIndex; - property public final String? title; - property public final String? uri; - } - - public final class CitationMetadata { - method public java.util.List getCitations(); - property public final java.util.List citations; - } - - public final class Content { - ctor public Content(String? role = "user", java.util.List parts); - ctor public Content(java.util.List parts); - method public com.google.firebase.vertexai.type.Content copy(String? role = role, java.util.List parts = parts); - method public java.util.List getParts(); - method public String? getRole(); - property public final java.util.List parts; - property public final String? role; - } - - public static final class Content.Builder { - ctor public Content.Builder(); - method public com.google.firebase.vertexai.type.Content.Builder addFileData(String uri, String mimeType); - method public com.google.firebase.vertexai.type.Content.Builder addImage(android.graphics.Bitmap image); - method public com.google.firebase.vertexai.type.Content.Builder addInlineData(byte[] bytes, String mimeType); - method public com.google.firebase.vertexai.type.Content.Builder addPart(T data); - method public com.google.firebase.vertexai.type.Content.Builder addText(String text); - method public com.google.firebase.vertexai.type.Content build(); - method public java.util.List getParts(); - method public String? getRole(); - method public void setParts(java.util.List); - method public void setRole(String?); - property public final java.util.List parts; - property public final String? role; - } - - public final class ContentBlockedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + @Deprecated public final class AudioRecordInitializationFailedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + ctor @Deprecated public AudioRecordInitializationFailedException(String message); + } + + @Deprecated public final class BlockReason { + method @Deprecated public String getName(); + method @Deprecated public int getOrdinal(); + property @Deprecated public final String name; + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.BlockReason BLOCKLIST; + field @Deprecated public static final com.google.firebase.vertexai.type.BlockReason.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.BlockReason OTHER; + field @Deprecated public static final com.google.firebase.vertexai.type.BlockReason PROHIBITED_CONTENT; + field @Deprecated public static final com.google.firebase.vertexai.type.BlockReason SAFETY; + field @Deprecated public static final com.google.firebase.vertexai.type.BlockReason UNKNOWN; + } + + @Deprecated public static final class BlockReason.Companion { + } + + @Deprecated public final class Candidate { + method @Deprecated public com.google.firebase.vertexai.type.CitationMetadata? getCitationMetadata(); + method @Deprecated public com.google.firebase.vertexai.type.Content getContent(); + method @Deprecated public com.google.firebase.vertexai.type.FinishReason? getFinishReason(); + method @Deprecated public java.util.List getSafetyRatings(); + property @Deprecated public final com.google.firebase.vertexai.type.CitationMetadata? citationMetadata; + property @Deprecated public final com.google.firebase.vertexai.type.Content content; + property @Deprecated public final com.google.firebase.vertexai.type.FinishReason? finishReason; + property @Deprecated public final java.util.List safetyRatings; + } + + @Deprecated public final class Citation { + method @Deprecated public int getEndIndex(); + method @Deprecated public String? getLicense(); + method @Deprecated public java.util.Calendar? getPublicationDate(); + method @Deprecated public int getStartIndex(); + method @Deprecated public String? getTitle(); + method @Deprecated public String? getUri(); + property @Deprecated public final int endIndex; + property @Deprecated public final String? license; + property @Deprecated public final java.util.Calendar? publicationDate; + property @Deprecated public final int startIndex; + property @Deprecated public final String? title; + property @Deprecated public final String? uri; + } + + @Deprecated public final class CitationMetadata { + method @Deprecated public java.util.List getCitations(); + property @Deprecated public final java.util.List citations; + } + + @Deprecated public final class Content { + ctor @Deprecated public Content(String? role = "user", java.util.List parts); + ctor @Deprecated public Content(java.util.List parts); + method @Deprecated public com.google.firebase.vertexai.type.Content copy(String? role = role, java.util.List parts = parts); + method @Deprecated public java.util.List getParts(); + method @Deprecated public String? getRole(); + property @Deprecated public final java.util.List parts; + property @Deprecated public final String? role; + } + + @Deprecated public static final class Content.Builder { + ctor @Deprecated public Content.Builder(); + method @Deprecated public com.google.firebase.vertexai.type.Content.Builder addFileData(String uri, String mimeType); + method @Deprecated public com.google.firebase.vertexai.type.Content.Builder addImage(android.graphics.Bitmap image); + method @Deprecated public com.google.firebase.vertexai.type.Content.Builder addInlineData(byte[] bytes, String mimeType); + method @Deprecated public com.google.firebase.vertexai.type.Content.Builder addPart(T data); + method @Deprecated public com.google.firebase.vertexai.type.Content.Builder addText(String text); + method @Deprecated public com.google.firebase.vertexai.type.Content build(); + method @Deprecated public java.util.List getParts(); + method @Deprecated public String? getRole(); + method @Deprecated public void setParts(java.util.List); + method @Deprecated public void setRole(String?); + property @Deprecated public final java.util.List parts; + property @Deprecated public final String? role; + } + + @Deprecated public final class ContentBlockedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { } public final class ContentKt { method public static com.google.firebase.vertexai.type.Content content(String? role = "user", kotlin.jvm.functions.Function1 init); } - public final class ContentModality { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.ContentModality AUDIO; - field public static final com.google.firebase.vertexai.type.ContentModality.Companion Companion; - field public static final com.google.firebase.vertexai.type.ContentModality DOCUMENT; - field public static final com.google.firebase.vertexai.type.ContentModality IMAGE; - field public static final com.google.firebase.vertexai.type.ContentModality TEXT; - field public static final com.google.firebase.vertexai.type.ContentModality UNSPECIFIED; - field public static final com.google.firebase.vertexai.type.ContentModality VIDEO; + @Deprecated public final class ContentModality { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality AUDIO; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality DOCUMENT; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality IMAGE; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality TEXT; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality UNSPECIFIED; + field @Deprecated public static final com.google.firebase.vertexai.type.ContentModality VIDEO; + } + + @Deprecated public static final class ContentModality.Companion { + } + + @Deprecated public final class CountTokensResponse { + ctor @Deprecated public CountTokensResponse(int totalTokens, Integer? totalBillableCharacters = null, java.util.List promptTokensDetails = emptyList()); + method @Deprecated public operator int component1(); + method @Deprecated public operator Integer? component2(); + method @Deprecated public operator java.util.List? component3(); + method @Deprecated public java.util.List getPromptTokensDetails(); + method @Deprecated public Integer? getTotalBillableCharacters(); + method @Deprecated public int getTotalTokens(); + property @Deprecated public final java.util.List promptTokensDetails; + property @Deprecated public final Integer? totalBillableCharacters; + property @Deprecated public final int totalTokens; + } + + @Deprecated public final class FileDataPart implements com.google.firebase.vertexai.type.Part { + ctor @Deprecated public FileDataPart(String uri, String mimeType); + method @Deprecated public String getMimeType(); + method @Deprecated public String getUri(); + property @Deprecated public final String mimeType; + property @Deprecated public final String uri; + } + + @Deprecated public final class FinishReason { + method @Deprecated public String getName(); + method @Deprecated public int getOrdinal(); + property @Deprecated public final String name; + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason BLOCKLIST; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason MALFORMED_FUNCTION_CALL; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason MAX_TOKENS; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason OTHER; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason PROHIBITED_CONTENT; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason RECITATION; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason SAFETY; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason SPII; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason STOP; + field @Deprecated public static final com.google.firebase.vertexai.type.FinishReason UNKNOWN; + } + + @Deprecated public static final class FinishReason.Companion { + } + + @Deprecated public abstract class FirebaseVertexAIException extends java.lang.RuntimeException { + } + + @Deprecated public final class FunctionCallPart implements com.google.firebase.vertexai.type.Part { + ctor @Deprecated public FunctionCallPart(String name, java.util.Map args); + ctor @Deprecated public FunctionCallPart(String name, java.util.Map args, String? id = null); + method @Deprecated public java.util.Map getArgs(); + method @Deprecated public String? getId(); + method @Deprecated public String getName(); + property @Deprecated public final java.util.Map args; + property @Deprecated public final String? id; + property @Deprecated public final String name; + } + + @Deprecated public final class FunctionCallingConfig { + method @Deprecated public static com.google.firebase.vertexai.type.FunctionCallingConfig any(); + method @Deprecated public static com.google.firebase.vertexai.type.FunctionCallingConfig any(java.util.List? allowedFunctionNames = null); + method @Deprecated public static com.google.firebase.vertexai.type.FunctionCallingConfig auto(); + method @Deprecated public static com.google.firebase.vertexai.type.FunctionCallingConfig none(); + field @Deprecated public static final com.google.firebase.vertexai.type.FunctionCallingConfig.Companion Companion; + } + + @Deprecated public static final class FunctionCallingConfig.Companion { + method @Deprecated public com.google.firebase.vertexai.type.FunctionCallingConfig any(); + method @Deprecated public com.google.firebase.vertexai.type.FunctionCallingConfig any(java.util.List? allowedFunctionNames = null); + method @Deprecated public com.google.firebase.vertexai.type.FunctionCallingConfig auto(); + method @Deprecated public com.google.firebase.vertexai.type.FunctionCallingConfig none(); + } + + @Deprecated public final class FunctionDeclaration { + ctor @Deprecated public FunctionDeclaration(String name, String description, java.util.Map parameters, java.util.List optionalParameters = emptyList()); + } + + @Deprecated public final class FunctionResponsePart implements com.google.firebase.vertexai.type.Part { + ctor @Deprecated public FunctionResponsePart(String name, kotlinx.serialization.json.JsonObject response); + ctor @Deprecated public FunctionResponsePart(String name, kotlinx.serialization.json.JsonObject response, String? id = null); + method @Deprecated public String? getId(); + method @Deprecated public String getName(); + method @Deprecated public kotlinx.serialization.json.JsonObject getResponse(); + property @Deprecated public final String? id; + property @Deprecated public final String name; + property @Deprecated public final kotlinx.serialization.json.JsonObject response; + } + + @Deprecated public final class GenerateContentResponse { + ctor @Deprecated public GenerateContentResponse(java.util.List candidates, com.google.firebase.vertexai.type.PromptFeedback? promptFeedback, com.google.firebase.vertexai.type.UsageMetadata? usageMetadata); + method @Deprecated public java.util.List getCandidates(); + method @Deprecated public java.util.List getFunctionCalls(); + method @Deprecated public java.util.List getInlineDataParts(); + method @Deprecated public com.google.firebase.vertexai.type.PromptFeedback? getPromptFeedback(); + method @Deprecated public String? getText(); + method @Deprecated public com.google.firebase.vertexai.type.UsageMetadata? getUsageMetadata(); + property @Deprecated public final java.util.List candidates; + property @Deprecated public final java.util.List functionCalls; + property @Deprecated public final java.util.List inlineDataParts; + property @Deprecated public final com.google.firebase.vertexai.type.PromptFeedback? promptFeedback; + property @Deprecated public final String? text; + property @Deprecated public final com.google.firebase.vertexai.type.UsageMetadata? usageMetadata; + } + + @Deprecated public final class GenerationConfig { + field @Deprecated public static final com.google.firebase.vertexai.type.GenerationConfig.Companion Companion; + } + + @Deprecated public static final class GenerationConfig.Builder { + ctor @Deprecated public GenerationConfig.Builder(); + method @Deprecated public com.google.firebase.vertexai.type.GenerationConfig build(); + field @Deprecated public Integer? candidateCount; + field @Deprecated public Float? frequencyPenalty; + field @Deprecated public Integer? maxOutputTokens; + field @Deprecated public Float? presencePenalty; + field @Deprecated public String? responseMimeType; + field @Deprecated public java.util.List? responseModalities; + field @Deprecated public com.google.firebase.vertexai.type.Schema? responseSchema; + field @Deprecated public java.util.List? stopSequences; + field @Deprecated public Float? temperature; + field @Deprecated public Integer? topK; + field @Deprecated public Float? topP; + } + + @Deprecated public static final class GenerationConfig.Companion { + method @Deprecated public com.google.firebase.vertexai.type.GenerationConfig.Builder builder(); } - public static final class ContentModality.Companion { - } - - public final class CountTokensResponse { - ctor public CountTokensResponse(int totalTokens, Integer? totalBillableCharacters = null, java.util.List promptTokensDetails = emptyList()); - method public operator int component1(); - method public operator Integer? component2(); - method public operator java.util.List? component3(); - method public java.util.List getPromptTokensDetails(); - method public Integer? getTotalBillableCharacters(); - method public int getTotalTokens(); - property public final java.util.List promptTokensDetails; - property public final Integer? totalBillableCharacters; - property public final int totalTokens; - } - - public final class FileDataPart implements com.google.firebase.vertexai.type.Part { - ctor public FileDataPart(String uri, String mimeType); - method public String getMimeType(); - method public String getUri(); - property public final String mimeType; - property public final String uri; - } - - public final class FinishReason { - method public String getName(); - method public int getOrdinal(); - property public final String name; - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.FinishReason BLOCKLIST; - field public static final com.google.firebase.vertexai.type.FinishReason.Companion Companion; - field public static final com.google.firebase.vertexai.type.FinishReason MALFORMED_FUNCTION_CALL; - field public static final com.google.firebase.vertexai.type.FinishReason MAX_TOKENS; - field public static final com.google.firebase.vertexai.type.FinishReason OTHER; - field public static final com.google.firebase.vertexai.type.FinishReason PROHIBITED_CONTENT; - field public static final com.google.firebase.vertexai.type.FinishReason RECITATION; - field public static final com.google.firebase.vertexai.type.FinishReason SAFETY; - field public static final com.google.firebase.vertexai.type.FinishReason SPII; - field public static final com.google.firebase.vertexai.type.FinishReason STOP; - field public static final com.google.firebase.vertexai.type.FinishReason UNKNOWN; - } - - public static final class FinishReason.Companion { - } - - public abstract class FirebaseVertexAIException extends java.lang.RuntimeException { - } - - public final class FunctionCallPart implements com.google.firebase.vertexai.type.Part { - ctor public FunctionCallPart(String name, java.util.Map args); - method public java.util.Map getArgs(); - method public String getName(); - property public final java.util.Map args; - property public final String name; - } - - public final class FunctionCallingConfig { - method public static com.google.firebase.vertexai.type.FunctionCallingConfig any(); - method public static com.google.firebase.vertexai.type.FunctionCallingConfig any(java.util.List? allowedFunctionNames = null); - method public static com.google.firebase.vertexai.type.FunctionCallingConfig auto(); - method public static com.google.firebase.vertexai.type.FunctionCallingConfig none(); - field public static final com.google.firebase.vertexai.type.FunctionCallingConfig.Companion Companion; - } - - public static final class FunctionCallingConfig.Companion { - method public com.google.firebase.vertexai.type.FunctionCallingConfig any(); - method public com.google.firebase.vertexai.type.FunctionCallingConfig any(java.util.List? allowedFunctionNames = null); - method public com.google.firebase.vertexai.type.FunctionCallingConfig auto(); - method public com.google.firebase.vertexai.type.FunctionCallingConfig none(); - } - - public final class FunctionDeclaration { - ctor public FunctionDeclaration(String name, String description, java.util.Map parameters, java.util.List optionalParameters = emptyList()); - } - - public final class FunctionResponsePart implements com.google.firebase.vertexai.type.Part { - ctor public FunctionResponsePart(String name, kotlinx.serialization.json.JsonObject response); - method public String getName(); - method public kotlinx.serialization.json.JsonObject getResponse(); - property public final String name; - property public final kotlinx.serialization.json.JsonObject response; + public final class GenerationConfigKt { + method public static com.google.firebase.vertexai.type.GenerationConfig generationConfig(kotlin.jvm.functions.Function1 init); } - public final class GenerateContentResponse { - ctor public GenerateContentResponse(java.util.List candidates, com.google.firebase.vertexai.type.PromptFeedback? promptFeedback, com.google.firebase.vertexai.type.UsageMetadata? usageMetadata); - method public java.util.List getCandidates(); - method public java.util.List getFunctionCalls(); - method public java.util.List getInlineDataParts(); - method public com.google.firebase.vertexai.type.PromptFeedback? getPromptFeedback(); - method public String? getText(); - method public com.google.firebase.vertexai.type.UsageMetadata? getUsageMetadata(); - property public final java.util.List candidates; - property public final java.util.List functionCalls; - property public final java.util.List inlineDataParts; - property public final com.google.firebase.vertexai.type.PromptFeedback? promptFeedback; - property public final String? text; - property public final com.google.firebase.vertexai.type.UsageMetadata? usageMetadata; + @Deprecated public final class HarmBlockMethod { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockMethod.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockMethod PROBABILITY; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockMethod SEVERITY; } - public final class GenerationConfig { - field public static final com.google.firebase.vertexai.type.GenerationConfig.Companion Companion; - } - - public static final class GenerationConfig.Builder { - ctor public GenerationConfig.Builder(); - method public com.google.firebase.vertexai.type.GenerationConfig build(); - field public Integer? candidateCount; - field public Float? frequencyPenalty; - field public Integer? maxOutputTokens; - field public Float? presencePenalty; - field public String? responseMimeType; - field public java.util.List? responseModalities; - field public com.google.firebase.vertexai.type.Schema? responseSchema; - field public java.util.List? stopSequences; - field public Float? temperature; - field public Integer? topK; - field public Float? topP; + @Deprecated public static final class HarmBlockMethod.Companion { } - public static final class GenerationConfig.Companion { - method public com.google.firebase.vertexai.type.GenerationConfig.Builder builder(); + @Deprecated public final class HarmBlockThreshold { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockThreshold.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockThreshold LOW_AND_ABOVE; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockThreshold MEDIUM_AND_ABOVE; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockThreshold NONE; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockThreshold OFF; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmBlockThreshold ONLY_HIGH; } - public final class GenerationConfigKt { - method public static com.google.firebase.vertexai.type.GenerationConfig generationConfig(kotlin.jvm.functions.Function1 init); + @Deprecated public static final class HarmBlockThreshold.Companion { } - public final class HarmBlockMethod { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.HarmBlockMethod.Companion Companion; - field public static final com.google.firebase.vertexai.type.HarmBlockMethod PROBABILITY; - field public static final com.google.firebase.vertexai.type.HarmBlockMethod SEVERITY; + @Deprecated public final class HarmCategory { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory CIVIC_INTEGRITY; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory DANGEROUS_CONTENT; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory HARASSMENT; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory HATE_SPEECH; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory SEXUALLY_EXPLICIT; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmCategory UNKNOWN; } - public static final class HarmBlockMethod.Companion { + @Deprecated public static final class HarmCategory.Companion { } - public final class HarmBlockThreshold { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.HarmBlockThreshold.Companion Companion; - field public static final com.google.firebase.vertexai.type.HarmBlockThreshold LOW_AND_ABOVE; - field public static final com.google.firebase.vertexai.type.HarmBlockThreshold MEDIUM_AND_ABOVE; - field public static final com.google.firebase.vertexai.type.HarmBlockThreshold NONE; - field public static final com.google.firebase.vertexai.type.HarmBlockThreshold OFF; - field public static final com.google.firebase.vertexai.type.HarmBlockThreshold ONLY_HIGH; + @Deprecated public final class HarmProbability { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmProbability.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmProbability HIGH; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmProbability LOW; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmProbability MEDIUM; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmProbability NEGLIGIBLE; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmProbability UNKNOWN; } - public static final class HarmBlockThreshold.Companion { + @Deprecated public static final class HarmProbability.Companion { } - public final class HarmCategory { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.HarmCategory CIVIC_INTEGRITY; - field public static final com.google.firebase.vertexai.type.HarmCategory.Companion Companion; - field public static final com.google.firebase.vertexai.type.HarmCategory DANGEROUS_CONTENT; - field public static final com.google.firebase.vertexai.type.HarmCategory HARASSMENT; - field public static final com.google.firebase.vertexai.type.HarmCategory HATE_SPEECH; - field public static final com.google.firebase.vertexai.type.HarmCategory SEXUALLY_EXPLICIT; - field public static final com.google.firebase.vertexai.type.HarmCategory UNKNOWN; + @Deprecated public final class HarmSeverity { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmSeverity.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmSeverity HIGH; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmSeverity LOW; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmSeverity MEDIUM; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmSeverity NEGLIGIBLE; + field @Deprecated public static final com.google.firebase.vertexai.type.HarmSeverity UNKNOWN; } - public static final class HarmCategory.Companion { + @Deprecated public static final class HarmSeverity.Companion { } - public final class HarmProbability { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.HarmProbability.Companion Companion; - field public static final com.google.firebase.vertexai.type.HarmProbability HIGH; - field public static final com.google.firebase.vertexai.type.HarmProbability LOW; - field public static final com.google.firebase.vertexai.type.HarmProbability MEDIUM; - field public static final com.google.firebase.vertexai.type.HarmProbability NEGLIGIBLE; - field public static final com.google.firebase.vertexai.type.HarmProbability UNKNOWN; + @Deprecated public final class ImagePart implements com.google.firebase.vertexai.type.Part { + ctor @Deprecated public ImagePart(android.graphics.Bitmap image); + method @Deprecated public android.graphics.Bitmap getImage(); + property @Deprecated public final android.graphics.Bitmap image; } - public static final class HarmProbability.Companion { + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenAspectRatio { + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenAspectRatio.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenAspectRatio LANDSCAPE_16x9; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenAspectRatio LANDSCAPE_4x3; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenAspectRatio PORTRAIT_3x4; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenAspectRatio PORTRAIT_9x16; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenAspectRatio SQUARE_1x1; } - public final class HarmSeverity { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.HarmSeverity.Companion Companion; - field public static final com.google.firebase.vertexai.type.HarmSeverity HIGH; - field public static final com.google.firebase.vertexai.type.HarmSeverity LOW; - field public static final com.google.firebase.vertexai.type.HarmSeverity MEDIUM; - field public static final com.google.firebase.vertexai.type.HarmSeverity NEGLIGIBLE; - field public static final com.google.firebase.vertexai.type.HarmSeverity UNKNOWN; + @Deprecated public static final class ImagenAspectRatio.Companion { } - public static final class HarmSeverity.Companion { + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenGenerationConfig { + ctor @Deprecated public ImagenGenerationConfig(String? negativePrompt = null, Integer? numberOfImages = 1, com.google.firebase.vertexai.type.ImagenAspectRatio? aspectRatio = null, com.google.firebase.vertexai.type.ImagenImageFormat? imageFormat = null, Boolean? addWatermark = null); + method @Deprecated public Boolean? getAddWatermark(); + method @Deprecated public com.google.firebase.vertexai.type.ImagenAspectRatio? getAspectRatio(); + method @Deprecated public com.google.firebase.vertexai.type.ImagenImageFormat? getImageFormat(); + method @Deprecated public String? getNegativePrompt(); + method @Deprecated public Integer? getNumberOfImages(); + property @Deprecated public final Boolean? addWatermark; + property @Deprecated public final com.google.firebase.vertexai.type.ImagenAspectRatio? aspectRatio; + property @Deprecated public final com.google.firebase.vertexai.type.ImagenImageFormat? imageFormat; + property @Deprecated public final String? negativePrompt; + property @Deprecated public final Integer? numberOfImages; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenGenerationConfig.Companion Companion; } - public final class ImagePart implements com.google.firebase.vertexai.type.Part { - ctor public ImagePart(android.graphics.Bitmap image); - method public android.graphics.Bitmap getImage(); - property public final android.graphics.Bitmap image; + @Deprecated public static final class ImagenGenerationConfig.Builder { + ctor @Deprecated public ImagenGenerationConfig.Builder(); + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig build(); + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setAddWatermark(boolean addWatermark); + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setAspectRatio(com.google.firebase.vertexai.type.ImagenAspectRatio aspectRatio); + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setImageFormat(com.google.firebase.vertexai.type.ImagenImageFormat imageFormat); + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setNegativePrompt(String negativePrompt); + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setNumberOfImages(int numberOfImages); + field @Deprecated public Boolean? addWatermark; + field @Deprecated public com.google.firebase.vertexai.type.ImagenAspectRatio? aspectRatio; + field @Deprecated public com.google.firebase.vertexai.type.ImagenImageFormat? imageFormat; + field @Deprecated public String? negativePrompt; + field @Deprecated public Integer? numberOfImages; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenAspectRatio { - field public static final com.google.firebase.vertexai.type.ImagenAspectRatio.Companion Companion; - field public static final com.google.firebase.vertexai.type.ImagenAspectRatio LANDSCAPE_16x9; - field public static final com.google.firebase.vertexai.type.ImagenAspectRatio LANDSCAPE_4x3; - field public static final com.google.firebase.vertexai.type.ImagenAspectRatio PORTRAIT_3x4; - field public static final com.google.firebase.vertexai.type.ImagenAspectRatio PORTRAIT_9x16; - field public static final com.google.firebase.vertexai.type.ImagenAspectRatio SQUARE_1x1; + @Deprecated public static final class ImagenGenerationConfig.Companion { + method @Deprecated public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder builder(); } - public static final class ImagenAspectRatio.Companion { + public final class ImagenGenerationConfigKt { + method @com.google.firebase.vertexai.type.PublicPreviewAPI public static com.google.firebase.vertexai.type.ImagenGenerationConfig imagenGenerationConfig(kotlin.jvm.functions.Function1 init); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenGenerationConfig { - ctor public ImagenGenerationConfig(String? negativePrompt = null, Integer? numberOfImages = 1, com.google.firebase.vertexai.type.ImagenAspectRatio? aspectRatio = null, com.google.firebase.vertexai.type.ImagenImageFormat? imageFormat = null, Boolean? addWatermark = null); - method public Boolean? getAddWatermark(); - method public com.google.firebase.vertexai.type.ImagenAspectRatio? getAspectRatio(); - method public com.google.firebase.vertexai.type.ImagenImageFormat? getImageFormat(); - method public String? getNegativePrompt(); - method public Integer? getNumberOfImages(); - property public final Boolean? addWatermark; - property public final com.google.firebase.vertexai.type.ImagenAspectRatio? aspectRatio; - property public final com.google.firebase.vertexai.type.ImagenImageFormat? imageFormat; - property public final String? negativePrompt; - property public final Integer? numberOfImages; - field public static final com.google.firebase.vertexai.type.ImagenGenerationConfig.Companion Companion; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenGenerationResponse { + method @Deprecated public String? getFilteredReason(); + method @Deprecated public java.util.List getImages(); + property @Deprecated public final String? filteredReason; + property @Deprecated public final java.util.List images; } - public static final class ImagenGenerationConfig.Builder { - ctor public ImagenGenerationConfig.Builder(); - method public com.google.firebase.vertexai.type.ImagenGenerationConfig build(); - method public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setAddWatermark(boolean addWatermark); - method public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setAspectRatio(com.google.firebase.vertexai.type.ImagenAspectRatio aspectRatio); - method public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setImageFormat(com.google.firebase.vertexai.type.ImagenImageFormat imageFormat); - method public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setNegativePrompt(String negativePrompt); - method public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder setNumberOfImages(int numberOfImages); - field public Boolean? addWatermark; - field public com.google.firebase.vertexai.type.ImagenAspectRatio? aspectRatio; - field public com.google.firebase.vertexai.type.ImagenImageFormat? imageFormat; - field public String? negativePrompt; - field public Integer? numberOfImages; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenImageFormat { + method @Deprecated public Integer? getCompressionQuality(); + method @Deprecated public String getMimeType(); + method @Deprecated public static com.google.firebase.vertexai.type.ImagenImageFormat jpeg(Integer? compressionQuality = null); + method @Deprecated public static com.google.firebase.vertexai.type.ImagenImageFormat png(); + property @Deprecated public final Integer? compressionQuality; + property @Deprecated public final String mimeType; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenImageFormat.Companion Companion; } - public static final class ImagenGenerationConfig.Companion { - method public com.google.firebase.vertexai.type.ImagenGenerationConfig.Builder builder(); + @Deprecated public static final class ImagenImageFormat.Companion { + method @Deprecated public com.google.firebase.vertexai.type.ImagenImageFormat jpeg(Integer? compressionQuality = null); + method @Deprecated public com.google.firebase.vertexai.type.ImagenImageFormat png(); } - public final class ImagenGenerationConfigKt { - method @com.google.firebase.vertexai.type.PublicPreviewAPI public static com.google.firebase.vertexai.type.ImagenGenerationConfig imagenGenerationConfig(kotlin.jvm.functions.Function1 init); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenInlineImage { + method @Deprecated public android.graphics.Bitmap asBitmap(); + method @Deprecated public byte[] getData(); + method @Deprecated public String getMimeType(); + property @Deprecated public final byte[] data; + property @Deprecated public final String mimeType; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenGenerationResponse { - method public String? getFilteredReason(); - method public java.util.List getImages(); - property public final String? filteredReason; - property public final java.util.List images; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenPersonFilterLevel { + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel ALLOW_ADULT; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel ALLOW_ALL; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel BLOCK_ALL; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel.Companion Companion; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenImageFormat { - method public Integer? getCompressionQuality(); - method public String getMimeType(); - method public static com.google.firebase.vertexai.type.ImagenImageFormat jpeg(Integer? compressionQuality = null); - method public static com.google.firebase.vertexai.type.ImagenImageFormat png(); - property public final Integer? compressionQuality; - property public final String mimeType; - field public static final com.google.firebase.vertexai.type.ImagenImageFormat.Companion Companion; + @Deprecated public static final class ImagenPersonFilterLevel.Companion { } - public static final class ImagenImageFormat.Companion { - method public com.google.firebase.vertexai.type.ImagenImageFormat jpeg(Integer? compressionQuality = null); - method public com.google.firebase.vertexai.type.ImagenImageFormat png(); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenSafetyFilterLevel { + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_LOW_AND_ABOVE; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_MEDIUM_AND_ABOVE; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_NONE; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_ONLY_HIGH; + field @Deprecated public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel.Companion Companion; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenInlineImage { - method public android.graphics.Bitmap asBitmap(); - method public byte[] getData(); - method public String getMimeType(); - property public final byte[] data; - property public final String mimeType; + @Deprecated public static final class ImagenSafetyFilterLevel.Companion { } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenPersonFilterLevel { - field public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel ALLOW_ADULT; - field public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel ALLOW_ALL; - field public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel BLOCK_ALL; - field public static final com.google.firebase.vertexai.type.ImagenPersonFilterLevel.Companion Companion; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenSafetySettings { + ctor @Deprecated public ImagenSafetySettings(com.google.firebase.vertexai.type.ImagenSafetyFilterLevel safetyFilterLevel, com.google.firebase.vertexai.type.ImagenPersonFilterLevel personFilterLevel); } - public static final class ImagenPersonFilterLevel.Companion { + @Deprecated public final class InlineDataPart implements com.google.firebase.vertexai.type.Part { + ctor @Deprecated public InlineDataPart(byte[] inlineData, String mimeType); + method @Deprecated public byte[] getInlineData(); + method @Deprecated public String getMimeType(); + property @Deprecated public final byte[] inlineData; + property @Deprecated public final String mimeType; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenSafetyFilterLevel { - field public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_LOW_AND_ABOVE; - field public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_MEDIUM_AND_ABOVE; - field public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_NONE; - field public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel BLOCK_ONLY_HIGH; - field public static final com.google.firebase.vertexai.type.ImagenSafetyFilterLevel.Companion Companion; + @Deprecated public final class InvalidAPIKeyException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { } - public static final class ImagenSafetyFilterLevel.Companion { + @Deprecated public final class InvalidLocationException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class ImagenSafetySettings { - ctor public ImagenSafetySettings(com.google.firebase.vertexai.type.ImagenSafetyFilterLevel safetyFilterLevel, com.google.firebase.vertexai.type.ImagenPersonFilterLevel personFilterLevel); + @Deprecated public final class InvalidStateException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { } - public final class InlineDataPart implements com.google.firebase.vertexai.type.Part { - ctor public InlineDataPart(byte[] inlineData, String mimeType); - method public byte[] getInlineData(); - method public String getMimeType(); - property public final byte[] inlineData; - property public final String mimeType; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveGenerationConfig { + field @Deprecated public static final com.google.firebase.vertexai.type.LiveGenerationConfig.Companion Companion; } - public final class InvalidAPIKeyException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + @Deprecated public static final class LiveGenerationConfig.Builder { + ctor @Deprecated public LiveGenerationConfig.Builder(); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig build(); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setCandidateCount(Integer? candidateCount); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setFrequencyPenalty(Float? frequencyPenalty); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setMaxOutputTokens(Integer? maxOutputTokens); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setPresencePenalty(Float? presencePenalty); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setResponseModality(com.google.firebase.vertexai.type.ResponseModality? responseModality); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setSpeechConfig(com.google.firebase.vertexai.type.SpeechConfig? speechConfig); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setTemperature(Float? temperature); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setTopK(Integer? topK); + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setTopP(Float? topP); + field @Deprecated public Integer? candidateCount; + field @Deprecated public Float? frequencyPenalty; + field @Deprecated public Integer? maxOutputTokens; + field @Deprecated public Float? presencePenalty; + field @Deprecated public com.google.firebase.vertexai.type.ResponseModality? responseModality; + field @Deprecated public com.google.firebase.vertexai.type.SpeechConfig? speechConfig; + field @Deprecated public Float? temperature; + field @Deprecated public Integer? topK; + field @Deprecated public Float? topP; } - public final class InvalidLocationException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + @Deprecated public static final class LiveGenerationConfig.Companion { + method @Deprecated public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder builder(); } - public final class InvalidStateException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + public final class LiveGenerationConfigKt { + method public static com.google.firebase.vertexai.type.LiveGenerationConfig liveGenerationConfig(kotlin.jvm.functions.Function1 init); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveContentResponse { - method public com.google.firebase.vertexai.type.Content? getData(); - method public java.util.List? getFunctionCalls(); - method public Boolean? getInterrupted(); - method public String? getText(); - method public Boolean? getTurnComplete(); - property public final com.google.firebase.vertexai.type.Content? data; - property public final java.util.List? functionCalls; - property public final Boolean? interrupted; - property public final String? text; - property public final Boolean? turnComplete; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveServerContent implements com.google.firebase.vertexai.type.LiveServerMessage { + ctor @Deprecated public LiveServerContent(com.google.firebase.vertexai.type.Content? content, boolean interrupted, boolean turnComplete, boolean generationComplete); + method @Deprecated public com.google.firebase.vertexai.type.Content? getContent(); + method @Deprecated public boolean getGenerationComplete(); + method @Deprecated public boolean getInterrupted(); + method @Deprecated public boolean getTurnComplete(); + property @Deprecated public final com.google.firebase.vertexai.type.Content? content; + property @Deprecated public final boolean generationComplete; + property @Deprecated public final boolean interrupted; + property @Deprecated public final boolean turnComplete; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveGenerationConfig { - field public static final com.google.firebase.vertexai.type.LiveGenerationConfig.Companion Companion; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public interface LiveServerMessage { } - public static final class LiveGenerationConfig.Builder { - ctor public LiveGenerationConfig.Builder(); - method public com.google.firebase.vertexai.type.LiveGenerationConfig build(); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setCandidateCount(Integer? candidateCount); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setFrequencyPenalty(Float? frequencyPenalty); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setMaxOutputTokens(Integer? maxOutputTokens); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setPresencePenalty(Float? presencePenalty); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setResponseModality(com.google.firebase.vertexai.type.ResponseModality? responseModality); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setSpeechConfig(com.google.firebase.vertexai.type.SpeechConfig? speechConfig); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setTemperature(Float? temperature); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setTopK(Integer? topK); - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder setTopP(Float? topP); - field public Integer? candidateCount; - field public Float? frequencyPenalty; - field public Integer? maxOutputTokens; - field public Float? presencePenalty; - field public com.google.firebase.vertexai.type.ResponseModality? responseModality; - field public com.google.firebase.vertexai.type.SpeechConfig? speechConfig; - field public Float? temperature; - field public Integer? topK; - field public Float? topP; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveServerSetupComplete implements com.google.firebase.vertexai.type.LiveServerMessage { + ctor @Deprecated public LiveServerSetupComplete(); } - public static final class LiveGenerationConfig.Companion { - method public com.google.firebase.vertexai.type.LiveGenerationConfig.Builder builder(); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveServerToolCall implements com.google.firebase.vertexai.type.LiveServerMessage { + ctor @Deprecated public LiveServerToolCall(java.util.List functionCalls); + method @Deprecated public java.util.List getFunctionCalls(); + property @Deprecated public final java.util.List functionCalls; } - public final class LiveGenerationConfigKt { - method public static com.google.firebase.vertexai.type.LiveGenerationConfig liveGenerationConfig(kotlin.jvm.functions.Function1 init); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveServerToolCallCancellation implements com.google.firebase.vertexai.type.LiveServerMessage { + ctor @Deprecated public LiveServerToolCallCancellation(java.util.List functionIds); + method @Deprecated public java.util.List getFunctionIds(); + property @Deprecated public final java.util.List functionIds; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveSession { - method public suspend Object? close(kotlin.coroutines.Continuation); - method public kotlinx.coroutines.flow.Flow receive(); - method public suspend Object? send(com.google.firebase.vertexai.type.Content content, kotlin.coroutines.Continuation); - method public suspend Object? send(String text, kotlin.coroutines.Continuation); - method public suspend Object? sendFunctionResponse(java.util.List functionList, kotlin.coroutines.Continuation); - method public suspend Object? sendMediaStream(java.util.List mediaChunks, kotlin.coroutines.Continuation); - method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public suspend Object? startAudioConversation(kotlin.jvm.functions.Function1? functionCallHandler = null, kotlin.coroutines.Continuation); - method public void stopAudioConversation(); - method public void stopReceiving(); + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class LiveSession { + method @Deprecated public suspend Object? close(kotlin.coroutines.Continuation); + method @Deprecated public kotlinx.coroutines.flow.Flow receive(); + method @Deprecated public suspend Object? send(com.google.firebase.vertexai.type.Content content, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? send(String text, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? sendFunctionResponse(java.util.List functionList, kotlin.coroutines.Continuation); + method @Deprecated public suspend Object? sendMediaStream(java.util.List mediaChunks, kotlin.coroutines.Continuation); + method @Deprecated @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public suspend Object? startAudioConversation(kotlin.jvm.functions.Function1? functionCallHandler = null, kotlin.coroutines.Continuation); + method @Deprecated public void stopAudioConversation(); + method @Deprecated public void stopReceiving(); } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class MediaData { - ctor public MediaData(byte[] data, String mimeType); - method public byte[] getData(); - method public String getMimeType(); - property public final byte[] data; - property public final String mimeType; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class MediaData { + ctor @Deprecated public MediaData(byte[] data, String mimeType); + method @Deprecated public byte[] getData(); + method @Deprecated public String getMimeType(); + property @Deprecated public final byte[] data; + property @Deprecated public final String mimeType; } - public final class ModalityTokenCount { - method public operator com.google.firebase.vertexai.type.ContentModality component1(); - method public operator int component2(); - method public com.google.firebase.vertexai.type.ContentModality getModality(); - method public int getTokenCount(); - property public final com.google.firebase.vertexai.type.ContentModality modality; - property public final int tokenCount; + @Deprecated public final class ModalityTokenCount { + method @Deprecated public operator com.google.firebase.vertexai.type.ContentModality component1(); + method @Deprecated public operator int component2(); + method @Deprecated public com.google.firebase.vertexai.type.ContentModality getModality(); + method @Deprecated public int getTokenCount(); + property @Deprecated public final com.google.firebase.vertexai.type.ContentModality modality; + property @Deprecated public final int tokenCount; } - public interface Part { + @Deprecated public interface Part { } public final class PartKt { @@ -653,234 +677,234 @@ package com.google.firebase.vertexai.type { method public static String? asTextOrNull(com.google.firebase.vertexai.type.Part); } - public final class PromptBlockedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - method public com.google.firebase.vertexai.type.GenerateContentResponse? getResponse(); - property public final com.google.firebase.vertexai.type.GenerateContentResponse? response; + @Deprecated public final class PromptBlockedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + method @Deprecated public com.google.firebase.vertexai.type.GenerateContentResponse? getResponse(); + property @Deprecated public final com.google.firebase.vertexai.type.GenerateContentResponse? response; } - public final class PromptFeedback { - ctor public PromptFeedback(com.google.firebase.vertexai.type.BlockReason? blockReason, java.util.List safetyRatings, String? blockReasonMessage); - method public com.google.firebase.vertexai.type.BlockReason? getBlockReason(); - method public String? getBlockReasonMessage(); - method public java.util.List getSafetyRatings(); - property public final com.google.firebase.vertexai.type.BlockReason? blockReason; - property public final String? blockReasonMessage; - property public final java.util.List safetyRatings; + @Deprecated public final class PromptFeedback { + ctor @Deprecated public PromptFeedback(com.google.firebase.vertexai.type.BlockReason? blockReason, java.util.List safetyRatings, String? blockReasonMessage); + method @Deprecated public com.google.firebase.vertexai.type.BlockReason? getBlockReason(); + method @Deprecated public String? getBlockReasonMessage(); + method @Deprecated public java.util.List getSafetyRatings(); + property @Deprecated public final com.google.firebase.vertexai.type.BlockReason? blockReason; + property @Deprecated public final String? blockReasonMessage; + property @Deprecated public final java.util.List safetyRatings; } @kotlin.RequiresOptIn(level=kotlin.RequiresOptIn.Level.ERROR, message="This API is part of an experimental public preview and may change in " + "backwards-incompatible ways without notice.") @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) public @interface PublicPreviewAPI { } - public final class QuotaExceededException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - } - - public final class RequestOptions { - ctor public RequestOptions(); - ctor public RequestOptions(long timeoutInMillis = 180.seconds.inWholeMilliseconds); - } - - public final class RequestTimeoutException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - } - - public final class ResponseModality { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.ResponseModality AUDIO; - field public static final com.google.firebase.vertexai.type.ResponseModality.Companion Companion; - field public static final com.google.firebase.vertexai.type.ResponseModality IMAGE; - field public static final com.google.firebase.vertexai.type.ResponseModality TEXT; - } - - public static final class ResponseModality.Companion { - } - - public final class ResponseStoppedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - method public com.google.firebase.vertexai.type.GenerateContentResponse getResponse(); - property public final com.google.firebase.vertexai.type.GenerateContentResponse response; - } - - public final class SafetyRating { - method public Boolean? getBlocked(); - method public com.google.firebase.vertexai.type.HarmCategory getCategory(); - method public com.google.firebase.vertexai.type.HarmProbability getProbability(); - method public float getProbabilityScore(); - method public com.google.firebase.vertexai.type.HarmSeverity? getSeverity(); - method public Float? getSeverityScore(); - property public final Boolean? blocked; - property public final com.google.firebase.vertexai.type.HarmCategory category; - property public final com.google.firebase.vertexai.type.HarmProbability probability; - property public final float probabilityScore; - property public final com.google.firebase.vertexai.type.HarmSeverity? severity; - property public final Float? severityScore; - } - - public final class SafetySetting { - ctor public SafetySetting(com.google.firebase.vertexai.type.HarmCategory harmCategory, com.google.firebase.vertexai.type.HarmBlockThreshold threshold, com.google.firebase.vertexai.type.HarmBlockMethod? method = null); - } - - public final class Schema { - method public static com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items); - method public static com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null); - method public static com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema boolean(); - method public static com.google.firebase.vertexai.type.Schema boolean(String? description = null); - method public static com.google.firebase.vertexai.type.Schema boolean(String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema enumeration(java.util.List values); - method public static com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null); - method public static com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null, boolean nullable = false); - method public String? getDescription(); - method public java.util.List? getEnum(); - method public String? getFormat(); - method public com.google.firebase.vertexai.type.Schema? getItems(); - method public Boolean? getNullable(); - method public java.util.Map? getProperties(); - method public java.util.List? getRequired(); - method public String getType(); - method public static com.google.firebase.vertexai.type.Schema numDouble(); - method public static com.google.firebase.vertexai.type.Schema numDouble(String? description = null); - method public static com.google.firebase.vertexai.type.Schema numDouble(String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema numFloat(); - method public static com.google.firebase.vertexai.type.Schema numFloat(String? description = null); - method public static com.google.firebase.vertexai.type.Schema numFloat(String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema numInt(); - method public static com.google.firebase.vertexai.type.Schema numInt(String? description = null); - method public static com.google.firebase.vertexai.type.Schema numInt(String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema numLong(); - method public static com.google.firebase.vertexai.type.Schema numLong(String? description = null); - method public static com.google.firebase.vertexai.type.Schema numLong(String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties); - method public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList()); - method public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null); - method public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema str(); - method public static com.google.firebase.vertexai.type.Schema str(String? description = null); - method public static com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false); - method public static com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false, com.google.firebase.vertexai.type.StringFormat? format = null); - property public final String? description; - property public final java.util.List? enum; - property public final String? format; - property public final com.google.firebase.vertexai.type.Schema? items; - property public final Boolean? nullable; - property public final java.util.Map? properties; - property public final java.util.List? required; - property public final String type; - field public static final com.google.firebase.vertexai.type.Schema.Companion Companion; + @Deprecated public final class QuotaExceededException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + } + + @Deprecated public final class RequestOptions { + ctor @Deprecated public RequestOptions(); + ctor @Deprecated public RequestOptions(long timeoutInMillis = 180.seconds.inWholeMilliseconds); + } + + @Deprecated public final class RequestTimeoutException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + } + + @Deprecated public final class ResponseModality { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.ResponseModality AUDIO; + field @Deprecated public static final com.google.firebase.vertexai.type.ResponseModality.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.ResponseModality IMAGE; + field @Deprecated public static final com.google.firebase.vertexai.type.ResponseModality TEXT; + } + + @Deprecated public static final class ResponseModality.Companion { + } + + @Deprecated public final class ResponseStoppedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + method @Deprecated public com.google.firebase.vertexai.type.GenerateContentResponse getResponse(); + property @Deprecated public final com.google.firebase.vertexai.type.GenerateContentResponse response; + } + + @Deprecated public final class SafetyRating { + method @Deprecated public Boolean? getBlocked(); + method @Deprecated public com.google.firebase.vertexai.type.HarmCategory getCategory(); + method @Deprecated public com.google.firebase.vertexai.type.HarmProbability getProbability(); + method @Deprecated public float getProbabilityScore(); + method @Deprecated public com.google.firebase.vertexai.type.HarmSeverity? getSeverity(); + method @Deprecated public Float? getSeverityScore(); + property @Deprecated public final Boolean? blocked; + property @Deprecated public final com.google.firebase.vertexai.type.HarmCategory category; + property @Deprecated public final com.google.firebase.vertexai.type.HarmProbability probability; + property @Deprecated public final float probabilityScore; + property @Deprecated public final com.google.firebase.vertexai.type.HarmSeverity? severity; + property @Deprecated public final Float? severityScore; + } + + @Deprecated public final class SafetySetting { + ctor @Deprecated public SafetySetting(com.google.firebase.vertexai.type.HarmCategory harmCategory, com.google.firebase.vertexai.type.HarmBlockThreshold threshold, com.google.firebase.vertexai.type.HarmBlockMethod? method = null); + } + + @Deprecated public final class Schema { + method @Deprecated public static com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items); + method @Deprecated public static com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema boolean(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema boolean(String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema boolean(String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema enumeration(java.util.List values); + method @Deprecated public static com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null, boolean nullable = false); + method @Deprecated public String? getDescription(); + method @Deprecated public java.util.List? getEnum(); + method @Deprecated public String? getFormat(); + method @Deprecated public com.google.firebase.vertexai.type.Schema? getItems(); + method @Deprecated public Boolean? getNullable(); + method @Deprecated public java.util.Map? getProperties(); + method @Deprecated public java.util.List? getRequired(); + method @Deprecated public String getType(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numDouble(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numDouble(String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numDouble(String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numFloat(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numFloat(String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numFloat(String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numInt(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numInt(String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numInt(String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numLong(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numLong(String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema numLong(String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties); + method @Deprecated public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList()); + method @Deprecated public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema str(); + method @Deprecated public static com.google.firebase.vertexai.type.Schema str(String? description = null); + method @Deprecated public static com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false); + method @Deprecated public static com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false, com.google.firebase.vertexai.type.StringFormat? format = null); + property @Deprecated public final String? description; + property @Deprecated public final java.util.List? enum; + property @Deprecated public final String? format; + property @Deprecated public final com.google.firebase.vertexai.type.Schema? items; + property @Deprecated public final Boolean? nullable; + property @Deprecated public final java.util.Map? properties; + property @Deprecated public final java.util.List? required; + property @Deprecated public final String type; + field @Deprecated public static final com.google.firebase.vertexai.type.Schema.Companion Companion; } - public static final class Schema.Companion { - method public com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items); - method public com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null); - method public com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema boolean(); - method public com.google.firebase.vertexai.type.Schema boolean(String? description = null); - method public com.google.firebase.vertexai.type.Schema boolean(String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema enumeration(java.util.List values); - method public com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null); - method public com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema numDouble(); - method public com.google.firebase.vertexai.type.Schema numDouble(String? description = null); - method public com.google.firebase.vertexai.type.Schema numDouble(String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema numFloat(); - method public com.google.firebase.vertexai.type.Schema numFloat(String? description = null); - method public com.google.firebase.vertexai.type.Schema numFloat(String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema numInt(); - method public com.google.firebase.vertexai.type.Schema numInt(String? description = null); - method public com.google.firebase.vertexai.type.Schema numInt(String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema numLong(); - method public com.google.firebase.vertexai.type.Schema numLong(String? description = null); - method public com.google.firebase.vertexai.type.Schema numLong(String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties); - method public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList()); - method public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null); - method public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema str(); - method public com.google.firebase.vertexai.type.Schema str(String? description = null); - method public com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false); - method public com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false, com.google.firebase.vertexai.type.StringFormat? format = null); - } - - public final class SerializationException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - } - - public final class ServerException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - } - - public final class ServiceConnectionHandshakeFailedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - ctor public ServiceConnectionHandshakeFailedException(String message, Throwable? cause = null); - } - - public final class ServiceDisabledException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - } - - public final class SessionAlreadyReceivingException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { - ctor public SessionAlreadyReceivingException(); - } - - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class SpeechConfig { - ctor public SpeechConfig(com.google.firebase.vertexai.type.Voices voice); - method public com.google.firebase.vertexai.type.Voices getVoice(); - property public final com.google.firebase.vertexai.type.Voices voice; - } - - public abstract class StringFormat { - } - - public static final class StringFormat.Custom extends com.google.firebase.vertexai.type.StringFormat { - ctor public StringFormat.Custom(String value); - } - - public final class TextPart implements com.google.firebase.vertexai.type.Part { - ctor public TextPart(String text); - method public String getText(); - property public final String text; - } + @Deprecated public static final class Schema.Companion { + method @Deprecated public com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items); + method @Deprecated public com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema array(com.google.firebase.vertexai.type.Schema items, String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema boolean(); + method @Deprecated public com.google.firebase.vertexai.type.Schema boolean(String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema boolean(String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema enumeration(java.util.List values); + method @Deprecated public com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema enumeration(java.util.List values, String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema numDouble(); + method @Deprecated public com.google.firebase.vertexai.type.Schema numDouble(String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema numDouble(String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema numFloat(); + method @Deprecated public com.google.firebase.vertexai.type.Schema numFloat(String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema numFloat(String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema numInt(); + method @Deprecated public com.google.firebase.vertexai.type.Schema numInt(String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema numInt(String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema numLong(); + method @Deprecated public com.google.firebase.vertexai.type.Schema numLong(String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema numLong(String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties); + method @Deprecated public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList()); + method @Deprecated public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema obj(java.util.Map properties, java.util.List optionalProperties = emptyList(), String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema str(); + method @Deprecated public com.google.firebase.vertexai.type.Schema str(String? description = null); + method @Deprecated public com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false); + method @Deprecated public com.google.firebase.vertexai.type.Schema str(String? description = null, boolean nullable = false, com.google.firebase.vertexai.type.StringFormat? format = null); + } + + @Deprecated public final class SerializationException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + } + + @Deprecated public final class ServerException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + } + + @Deprecated public final class ServiceConnectionHandshakeFailedException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + ctor @Deprecated public ServiceConnectionHandshakeFailedException(String message, Throwable? cause = null); + } + + @Deprecated public final class ServiceDisabledException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + } + + @Deprecated public final class SessionAlreadyReceivingException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + ctor @Deprecated public SessionAlreadyReceivingException(); + } + + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class SpeechConfig { + ctor @Deprecated public SpeechConfig(com.google.firebase.vertexai.type.Voices voice); + method @Deprecated public com.google.firebase.vertexai.type.Voices getVoice(); + property @Deprecated public final com.google.firebase.vertexai.type.Voices voice; + } + + @Deprecated public abstract class StringFormat { + } + + @Deprecated public static final class StringFormat.Custom extends com.google.firebase.vertexai.type.StringFormat { + ctor @Deprecated public StringFormat.Custom(String value); + } + + @Deprecated public final class TextPart implements com.google.firebase.vertexai.type.Part { + ctor @Deprecated public TextPart(String text); + method @Deprecated public String getText(); + property @Deprecated public final String text; + } - public final class Tool { - method public static com.google.firebase.vertexai.type.Tool functionDeclarations(java.util.List functionDeclarations); - field public static final com.google.firebase.vertexai.type.Tool.Companion Companion; + @Deprecated public final class Tool { + method @Deprecated public static com.google.firebase.vertexai.type.Tool functionDeclarations(java.util.List functionDeclarations); + field @Deprecated public static final com.google.firebase.vertexai.type.Tool.Companion Companion; } - public static final class Tool.Companion { - method public com.google.firebase.vertexai.type.Tool functionDeclarations(java.util.List functionDeclarations); + @Deprecated public static final class Tool.Companion { + method @Deprecated public com.google.firebase.vertexai.type.Tool functionDeclarations(java.util.List functionDeclarations); } - public final class ToolConfig { - ctor public ToolConfig(com.google.firebase.vertexai.type.FunctionCallingConfig? functionCallingConfig); + @Deprecated public final class ToolConfig { + ctor @Deprecated public ToolConfig(com.google.firebase.vertexai.type.FunctionCallingConfig? functionCallingConfig); } - public final class UnknownException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + @Deprecated public final class UnknownException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { } - public final class UnsupportedUserLocationException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { + @Deprecated public final class UnsupportedUserLocationException extends com.google.firebase.vertexai.type.FirebaseVertexAIException { } - public final class UsageMetadata { - ctor public UsageMetadata(int promptTokenCount, Integer? candidatesTokenCount, int totalTokenCount, java.util.List promptTokensDetails, java.util.List candidatesTokensDetails); - method public Integer? getCandidatesTokenCount(); - method public java.util.List getCandidatesTokensDetails(); - method public int getPromptTokenCount(); - method public java.util.List getPromptTokensDetails(); - method public int getTotalTokenCount(); - property public final Integer? candidatesTokenCount; - property public final java.util.List candidatesTokensDetails; - property public final int promptTokenCount; - property public final java.util.List promptTokensDetails; - property public final int totalTokenCount; + @Deprecated public final class UsageMetadata { + ctor @Deprecated public UsageMetadata(int promptTokenCount, Integer? candidatesTokenCount, int totalTokenCount, java.util.List promptTokensDetails, java.util.List candidatesTokensDetails); + method @Deprecated public Integer? getCandidatesTokenCount(); + method @Deprecated public java.util.List getCandidatesTokensDetails(); + method @Deprecated public int getPromptTokenCount(); + method @Deprecated public java.util.List getPromptTokensDetails(); + method @Deprecated public int getTotalTokenCount(); + property @Deprecated public final Integer? candidatesTokenCount; + property @Deprecated public final java.util.List candidatesTokensDetails; + property @Deprecated public final int promptTokenCount; + property @Deprecated public final java.util.List promptTokensDetails; + property @Deprecated public final int totalTokenCount; } - @com.google.firebase.vertexai.type.PublicPreviewAPI public final class Voices { - method public int getOrdinal(); - property public final int ordinal; - field public static final com.google.firebase.vertexai.type.Voices AOEDE; - field public static final com.google.firebase.vertexai.type.Voices CHARON; - field public static final com.google.firebase.vertexai.type.Voices.Companion Companion; - field public static final com.google.firebase.vertexai.type.Voices FENRIR; - field public static final com.google.firebase.vertexai.type.Voices KORE; - field public static final com.google.firebase.vertexai.type.Voices PUCK; - field public static final com.google.firebase.vertexai.type.Voices UNSPECIFIED; + @Deprecated @com.google.firebase.vertexai.type.PublicPreviewAPI public final class Voices { + method @Deprecated public int getOrdinal(); + property @Deprecated public final int ordinal; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices AOEDE; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices CHARON; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices.Companion Companion; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices FENRIR; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices KORE; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices PUCK; + field @Deprecated public static final com.google.firebase.vertexai.type.Voices UNSPECIFIED; } - public static final class Voices.Companion { + @Deprecated public static final class Voices.Companion { } } diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/Chat.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/Chat.kt index 594be41310a..bcf0ff5d9c0 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/Chat.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/Chat.kt @@ -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 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. +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 = ArrayList() diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt index c36ec25d078..411c9c0c8b1 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt @@ -37,7 +37,7 @@ import com.google.firebase.vertexai.type.Tool import com.google.firebase.vertexai.type.ToolConfig import kotlin.coroutines.CoroutineContext -/** Entry point for all _Vertex AI for Firebase_ functionality. */ +/** Entry point for all _Vertex AI in Firebase_ functionality. */ public class FirebaseVertexAI internal constructor( private val firebaseApp: FirebaseApp, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAIMultiResourceComponent.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAIMultiResourceComponent.kt index 526e1f87be8..02e962951f9 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAIMultiResourceComponent.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAIMultiResourceComponent.kt @@ -25,7 +25,7 @@ import com.google.firebase.inject.Provider import kotlin.coroutines.CoroutineContext /** - * Multi-resource container for Firebase Vertex AI. + * Multi-resource container for Vertex AI in Firebase. * * @hide */ diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/GenerativeModel.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/GenerativeModel.kt index 3520aff2238..3a04907cacc 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/GenerativeModel.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/GenerativeModel.kt @@ -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 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. +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, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/ImagenModel.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/ImagenModel.kt index fa33ee6e327..30868aeb214 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/ImagenModel.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/ImagenModel.kt @@ -36,6 +36,10 @@ import com.google.firebase.vertexai.type.RequestOptions * types. */ @PublicPreviewAPI +@Deprecated( + """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. +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, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/LiveGenerativeModel.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/LiveGenerativeModel.kt index d546e09cdd2..d384793eb68 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/LiveGenerativeModel.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/LiveGenerativeModel.kt @@ -46,6 +46,10 @@ import kotlinx.serialization.json.JsonObject * various input types, supporting bidirectional streaming. */ @PublicPreviewAPI +@Deprecated( + """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. +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, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/APIController.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/APIController.kt index f82d4866cf6..9f5d105328e 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/APIController.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/common/APIController.kt @@ -164,7 +164,7 @@ internal constructor( "wss://firebasevertexai.googleapis.com/ws/google.firebase.vertexai.v1beta.LlmBidiService/BidiGenerateContent/locations/$location?key=$key" suspend fun getWebSocketSession(location: String): ClientWebSocketSession = - client.webSocketSession(getBidiEndpoint(location)) + client.webSocketSession(getBidiEndpoint(location)) { applyCommonHeaders() } fun generateContentStream( request: GenerateContentRequest @@ -197,6 +197,11 @@ internal constructor( is CountTokensRequest -> setBody(request) is GenerateImageRequest -> setBody(request) } + + applyCommonHeaders() + } + + private fun HttpRequestBuilder.applyCommonHeaders() { contentType(ContentType.Application.Json) header("x-goog-api-key", key) header("x-goog-api-client", apiClient) diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt index 2025342ff6e..c653d1930ea 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ChatFutures.kt @@ -30,6 +30,10 @@ import org.reactivestreams.Publisher * * @see [Chat] */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public abstract class ChatFutures internal constructor() { /** diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt index eae7603924b..635fa14cb48 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/GenerativeModelFutures.kt @@ -32,6 +32,10 @@ import org.reactivestreams.Publisher * * @see [GenerativeModel] */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public abstract class GenerativeModelFutures internal constructor() { /** diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ImagenModelFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ImagenModelFutures.kt index 97b043312c4..e24898d57b8 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ImagenModelFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/ImagenModelFutures.kt @@ -29,6 +29,10 @@ import com.google.firebase.vertexai.type.PublicPreviewAPI * @see [ImagenModel] */ @PublicPreviewAPI +@Deprecated( + """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. +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. diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveModelFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveModelFutures.kt index cc8fb8893d7..ea30126c00a 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveModelFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveModelFutures.kt @@ -28,6 +28,10 @@ import com.google.firebase.vertexai.type.ServiceConnectionHandshakeFailedExcepti * @see [LiveGenerativeModel] */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public abstract class LiveModelFutures internal constructor() { /** diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveSessionFutures.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveSessionFutures.kt index 169f9723ad8..7865ed8e7d9 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveSessionFutures.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/java/LiveSessionFutures.kt @@ -23,7 +23,7 @@ import com.google.common.util.concurrent.ListenableFuture import com.google.firebase.vertexai.type.Content import com.google.firebase.vertexai.type.FunctionCallPart import com.google.firebase.vertexai.type.FunctionResponsePart -import com.google.firebase.vertexai.type.LiveContentResponse +import com.google.firebase.vertexai.type.LiveServerMessage import com.google.firebase.vertexai.type.LiveSession import com.google.firebase.vertexai.type.MediaData import com.google.firebase.vertexai.type.PublicPreviewAPI @@ -38,6 +38,10 @@ import org.reactivestreams.Publisher * @see [LiveSession] */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public abstract class LiveSessionFutures internal constructor() { /** @@ -135,16 +139,16 @@ public abstract class LiveSessionFutures internal constructor() { * * Call [close] to stop receiving responses from the model. * - * @return A [Publisher] which will emit [LiveContentResponse] from the model. + * @return A [Publisher] which will emit [LiveServerMessage] from the model. * * @throws [SessionAlreadyReceivingException] when the session is already receiving. * @see stopReceiving */ - public abstract fun receive(): Publisher + public abstract fun receive(): Publisher private class FuturesImpl(private val session: LiveSession) : LiveSessionFutures() { - override fun receive(): Publisher = session.receive().asPublisher() + override fun receive(): Publisher = session.receive().asPublisher() override fun close(): ListenableFuture = SuspendToFutureAdapter.launchFuture { session.close() } diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Candidate.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Candidate.kt index b84bd6929f4..52dfd46239d 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Candidate.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Candidate.kt @@ -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 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. +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, @@ -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() @@ -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 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. +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, @@ -120,8 +128,8 @@ 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, @@ -129,14 +137,23 @@ internal constructor( ) { 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 + ) + } } } @@ -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 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. +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) { @Serializable @@ -173,6 +194,10 @@ public class CitationMetadata internal constructor(public val citations: List) { @@ -41,6 +45,10 @@ constructor(public val role: String? = "user", public val parts: List) { } /** Builder class to facilitate constructing complex [Content] objects. */ + @Deprecated( + """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. +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". */ diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ContentModality.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ContentModality.kt index ecd4e74d80a..4f1566eae1a 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ContentModality.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ContentModality.kt @@ -22,6 +22,10 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** Content part modality. */ +@Deprecated( + """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. +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) diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/CountTokensResponse.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/CountTokensResponse.kt index 49f6b0433e0..2c3396c83b2 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/CountTokensResponse.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/CountTokensResponse.kt @@ -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 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. +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, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Exceptions.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Exceptions.kt index 45e9ef027a6..8ea94ce2086 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Exceptions.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Exceptions.kt @@ -21,6 +21,10 @@ import com.google.firebase.vertexai.common.FirebaseCommonAIException import kotlinx.coroutines.TimeoutCancellationException /** Parent class for any errors that occur from the [FirebaseVertexAI] SDK. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public abstract class FirebaseVertexAIException internal constructor(message: String, cause: Throwable? = null) : RuntimeException(message, cause) { @@ -103,15 +107,27 @@ internal constructor(message: String, cause: Throwable? = null) : RuntimeExcepti } /** Something went wrong while trying to deserialize a response from the server. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class SerializationException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) /** The server responded with a non 200 response code. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ServerException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) /** The provided API Key is not valid. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class InvalidAPIKeyException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) @@ -123,6 +139,10 @@ internal constructor(message: String, cause: Throwable? = null) : * * @property response The full server response. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class PromptBlockedException internal constructor( public val response: GenerateContentResponse?, @@ -136,6 +156,10 @@ internal constructor( internal constructor(message: String, cause: Throwable? = null) : this(null, cause, message) } +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ContentBlockedException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) @@ -148,6 +172,10 @@ internal constructor(message: String, cause: Throwable? = null) : * (countries and territories) where the API is available. */ // TODO(rlazo): Add secondary constructor to pass through the message? +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class UnsupportedUserLocationException internal constructor(cause: Throwable? = null) : FirebaseVertexAIException("User location is not supported for the API use.", cause) @@ -156,6 +184,10 @@ public class UnsupportedUserLocationException internal constructor(cause: Throwa * * Usually indicative of consumer error. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class InvalidStateException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) @@ -164,6 +196,10 @@ public class InvalidStateException internal constructor(message: String, cause: * * @property response The full server response. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ResponseStoppedException internal constructor(public val response: GenerateContentResponse, cause: Throwable? = null) : FirebaseVertexAIException( @@ -176,6 +212,10 @@ internal constructor(public val response: GenerateContentResponse, cause: Throwa * * Usually occurs due to a user specified [timeout][RequestOptions.timeout]. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class RequestTimeoutException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) @@ -186,6 +226,10 @@ internal constructor(message: String, cause: Throwable? = null) : * For a list of valid locations, see * [Vertex AI locations.](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#available-regions) */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class InvalidLocationException internal constructor(location: String, cause: Throwable? = null) : FirebaseVertexAIException("Invalid location \"${location}\"", cause) @@ -195,6 +239,10 @@ internal constructor(location: String, cause: Throwable? = null) : * in the * [Firebase documentation.](https://firebase.google.com/docs/vertex-ai/faq-and-troubleshooting#required-apis) */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ServiceDisabledException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) @@ -203,24 +251,44 @@ internal constructor(message: String, cause: Throwable? = null) : * The request has hit a quota limit. Learn more about quotas in the * [Firebase documentation.](https://firebase.google.com/docs/vertex-ai/quotas) */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class QuotaExceededException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) /** Streaming session already receiving. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class SessionAlreadyReceivingException : FirebaseVertexAIException( "This session is already receiving. Please call stopReceiving() before calling this again." ) /** Audio record initialization failures for audio streaming */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class AudioRecordInitializationFailedException(message: String) : FirebaseVertexAIException(message) /** Handshake failed with the server */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ServiceConnectionHandshakeFailedException(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) /** Catch all case for exceptions not explicitly expected. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class UnknownException internal constructor(message: String, cause: Throwable? = null) : FirebaseVertexAIException(message, cause) diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionCallingConfig.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionCallingConfig.kt index ee557556bbc..4305064f37c 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionCallingConfig.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionCallingConfig.kt @@ -24,6 +24,10 @@ import kotlinx.serialization.Serializable * * See the static methods in the `companion object` for the list of available behaviors. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class FunctionCallingConfig internal constructor( internal val mode: Mode, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionDeclaration.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionDeclaration.kt index 8813de18b43..af07dc40188 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionDeclaration.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/FunctionDeclaration.kt @@ -52,6 +52,10 @@ import kotlinx.serialization.Serializable * function. * @see Schema */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class FunctionDeclaration( internal val name: String, internal val description: String, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerateContentResponse.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerateContentResponse.kt index 91c2cd8f4ea..afddffb8a15 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerateContentResponse.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerateContentResponse.kt @@ -26,6 +26,10 @@ import kotlinx.serialization.Serializable * When streaming, it's only populated in the first response. * @property usageMetadata Information about the number of tokens in the prompt and in the response. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class GenerateContentResponse( public val candidates: List, public val promptFeedback: PromptFeedback?, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerationConfig.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerationConfig.kt index 88705c58a92..9dfcb822b2c 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerationConfig.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/GenerationConfig.kt @@ -78,6 +78,10 @@ import kotlinx.serialization.Serializable * [Control generated output](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output) * guide for more details. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class GenerationConfig private constructor( internal val temperature: Float?, @@ -123,6 +127,10 @@ private constructor( * * @see [generationConfig] */ + @Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" + ) public class Builder { @JvmField public var temperature: Float? = null @JvmField public var topK: Int? = null diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockMethod.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockMethod.kt index 1bd16949b20..ffe87023d4c 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockMethod.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockMethod.kt @@ -24,6 +24,10 @@ import kotlinx.serialization.Serializable * Specifies how the block method computes the score that will be compared against the * [HarmBlockThreshold] in [SafetySetting]. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class HarmBlockMethod private constructor(public val ordinal: Int) { internal fun toInternal() = when (this) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockThreshold.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockThreshold.kt index d200fef9bf3..90fa451ad49 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockThreshold.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmBlockThreshold.kt @@ -21,6 +21,10 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** Represents the threshold for a [HarmCategory] to be allowed by [SafetySetting]. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class HarmBlockThreshold private constructor(public val ordinal: Int) { internal fun toInternal() = diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmCategory.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmCategory.kt index 2429688b02b..1850282e757 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmCategory.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmCategory.kt @@ -23,6 +23,10 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** Category for a given harm rating. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class HarmCategory private constructor(public val ordinal: Int) { internal fun toInternal() = when (this) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmProbability.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmProbability.kt index 3d13e177819..78c679ef935 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmProbability.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmProbability.kt @@ -22,6 +22,10 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** Represents the probability that some [HarmCategory] is applicable in a [SafetyRating]. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class HarmProbability private constructor(public val ordinal: Int) { @Serializable(Internal.Serializer::class) internal enum class Internal { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmSeverity.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmSeverity.kt index 0d0a39f2ac9..c01db75ec8e 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmSeverity.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/HarmSeverity.kt @@ -22,6 +22,10 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** Represents the severity of a [HarmCategory] being applicable in a [SafetyRating]. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class HarmSeverity private constructor(public val ordinal: Int) { @Serializable(Internal.Serializer::class) internal enum class Internal { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenAspectRatio.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenAspectRatio.kt index e605a6e987e..6243ce27770 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenAspectRatio.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenAspectRatio.kt @@ -18,6 +18,10 @@ package com.google.firebase.vertexai.type /** Represents the aspect ratio that the generated image should conform to. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenAspectRatio private constructor(internal val internalVal: String) { public companion object { /** A square image, useful for icons, profile pictures, etc. */ diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationConfig.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationConfig.kt index d05840d9cfc..508f28e62d7 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationConfig.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationConfig.kt @@ -29,6 +29,10 @@ package com.google.firebase.vertexai.type import kotlin.jvm.JvmField @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenGenerationConfig( public val negativePrompt: String? = null, public val numberOfImages: Int? = 1, @@ -42,6 +46,10 @@ public class ImagenGenerationConfig( * This is mainly intended for Java interop. For Kotlin, use [imagenGenerationConfig] for a more * idiomatic experience. */ + @Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" + ) public class Builder { @JvmField public var negativePrompt: String? = null @JvmField public var numberOfImages: Int? = 1 diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationResponse.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationResponse.kt index 454f526bbee..acc1b54b563 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationResponse.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenGenerationResponse.kt @@ -28,6 +28,10 @@ import kotlinx.serialization.Serializable * the reason they were filtered out. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenGenerationResponse internal constructor(public val images: List, public val filteredReason: String?) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenImageFormat.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenImageFormat.kt index 5a44ddc3964..afd309047cb 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenImageFormat.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenImageFormat.kt @@ -27,6 +27,10 @@ import kotlinx.serialization.Serializable * for every MIME type. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenImageFormat private constructor(public val mimeType: String, public val compressionQuality: Int?) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenInlineImage.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenInlineImage.kt index 1004f0a57ac..9af3e779082 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenInlineImage.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenInlineImage.kt @@ -27,6 +27,10 @@ import android.graphics.BitmapFactory * `"image/jpeg"`; to request a different format, see [ImagenGenerationConfig.imageFormat]. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenInlineImage internal constructor(public val data: ByteArray, public val mimeType: String) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenPersonFilterLevel.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenPersonFilterLevel.kt index 14031c86766..8d4de743345 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenPersonFilterLevel.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenPersonFilterLevel.kt @@ -18,6 +18,10 @@ package com.google.firebase.vertexai.type /** A filter used to prevent images from containing depictions of children or people. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenPersonFilterLevel private constructor(internal val internalVal: String) { public companion object { /** No filters applied. */ diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetyFilterLevel.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetyFilterLevel.kt index 205538ebc0a..72a325737ba 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetyFilterLevel.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetyFilterLevel.kt @@ -18,6 +18,10 @@ package com.google.firebase.vertexai.type /** Used for safety filtering. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenSafetyFilterLevel private constructor(internal val internalVal: String) { public companion object { /** Strongest filtering level, most strict blocking. */ diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetySettings.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetySettings.kt index d5a00b557bd..f619c8985d3 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetySettings.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ImagenSafetySettings.kt @@ -23,6 +23,10 @@ package com.google.firebase.vertexai.type * @param personFilterLevel Used to filter images containing people. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagenSafetySettings( internal val safetyFilterLevel: ImagenSafetyFilterLevel, internal val personFilterLevel: ImagenPersonFilterLevel, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveContentResponse.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveContentResponse.kt deleted file mode 100644 index 4ae1d5df255..00000000000 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveContentResponse.kt +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2025 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.firebase.vertexai.type - -/** - * Represents the response from the model for live content updates. - * - * This class encapsulates the content data, the status of the response, and any function calls - * included in the response. - */ -@PublicPreviewAPI -public class LiveContentResponse -internal constructor( - - /** The main content data of the response. This can be `null` if there is no content. */ - public val data: Content?, - - /** - * The model was interrupted while generating data. - * - * An interruption occurs when the client sends a message while the model is actively sending - * data. - */ - public val interrupted: Boolean?, - - /** - * The model has finished sending data in the current interaction. - * - * Can be set alongside content, signifying that the content is the last in the turn. - */ - public val turnComplete: Boolean?, - - /** - * A list of [FunctionCallPart] included in the response, if any. - * - * This list can be null or empty if no function calls are present. - */ - public val functionCalls: List? -) { - - /** - * Convenience field representing all the text parts in the response as a single string, if they - * exists. - */ - public val text: String? = - data?.parts?.filterIsInstance()?.joinToString(" ") { it.text } -} diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveGenerationConfig.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveGenerationConfig.kt index 36879ff7cfd..c3a51042641 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveGenerationConfig.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveGenerationConfig.kt @@ -65,6 +65,10 @@ import kotlinx.serialization.Serializable * guide for more details. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class LiveGenerationConfig private constructor( internal val temperature: Float?, @@ -102,6 +106,10 @@ private constructor( * * @property speechConfig See [LiveGenerationConfig.speechConfig] */ + @Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" + ) public class Builder { @JvmField public var temperature: Float? = null @JvmField public var topK: Int? = null diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveServerMessage.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveServerMessage.kt new file mode 100644 index 00000000000..c59624e0882 --- /dev/null +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveServerMessage.kt @@ -0,0 +1,211 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.firebase.vertexai.type + +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.JsonContentPolymorphicSerializer +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.JsonNull +import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.jsonObject + +/** + * Parent interface for responses from the model during live interactions. + * + * @see LiveServerContent + * @see LiveServerToolCall + * @see LiveServerToolCallCancellation + * @see LiveServerSetupComplete + */ +@PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public interface LiveServerMessage + +/** + * Incremental server update generated by the model in response to client messages. + * + * Content is generated as quickly as possible, and not in realtime. You may choose to buffer and + * play it out in realtime. + */ +@PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public class LiveServerContent( + /** + * The content that the model has generated as part of the current conversation with the user. + * + * This can be `null` if there is no content. + */ + public val content: Content?, + + /** + * The model was interrupted by the client while generating data. + * + * An interruption occurs when the client sends a message while the model is actively sending + * data. + */ + public val interrupted: Boolean, + + /** + * The model has finished sending data in the current turn. + * + * Generation will only start in response to additional client messages. + * + * Can be set alongside [content], indicating that the [content] is the last in the turn. + * + * @see generationComplete + */ + public val turnComplete: Boolean, + + /** + * The model has finished _generating_ data for the current turn. + * + * For realtime playback, there will be a delay between when the model finishes generating content + * and the client has finished playing back the generated content. [generationComplete] indicates + * that the model is done generating data, while [turnComplete] indicates the model is waiting for + * additional client messages. Sending a message during this delay may cause an [interrupted] + * message to be sent. + * + * Note that if the model was [interrupted], this will not be set. The model will go from + * [interrupted] -> [turnComplete]. + */ + public val generationComplete: Boolean, +) : LiveServerMessage { + @OptIn(ExperimentalSerializationApi::class) + @Serializable + internal data class Internal( + val modelTurn: Content.Internal? = null, + val interrupted: Boolean = false, + val turnComplete: Boolean = false, + val generationComplete: Boolean = false + ) + @Serializable + internal data class InternalWrapper(val serverContent: Internal) : InternalLiveServerMessage { + @OptIn(ExperimentalSerializationApi::class) + override fun toPublic() = + LiveServerContent( + serverContent.modelTurn?.toPublic(), + serverContent.interrupted, + serverContent.turnComplete, + serverContent.generationComplete + ) + } +} + +/** The model is ready to receive client messages. */ +@PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public class LiveServerSetupComplete : LiveServerMessage { + @Serializable + internal data class Internal(val setupComplete: JsonObject) : InternalLiveServerMessage { + override fun toPublic() = LiveServerSetupComplete() + } +} + +/** + * Request for the client to execute the provided [functionCalls]. + * + * The client should return matching [FunctionResponsePart], where the `id` fields correspond to + * individual [FunctionCallPart]s. + * + * @property functionCalls A list of [FunctionCallPart] to run and return responses for. + */ +@PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public class LiveServerToolCall(public val functionCalls: List) : + LiveServerMessage { + @Serializable + internal data class Internal( + val functionCalls: List = emptyList() + ) + @Serializable + internal data class InternalWrapper(val toolCall: Internal) : InternalLiveServerMessage { + override fun toPublic() = + LiveServerToolCall( + toolCall.functionCalls.map { functionCall -> + FunctionCallPart( + name = functionCall.name, + args = functionCall.args.orEmpty().mapValues { it.value ?: JsonNull } + ) + } + ) + } +} + +/** + * Notification for the client to cancel a previous function call from [LiveServerToolCall]. + * + * You do not need to send [FunctionResponsePart]s for the cancelled [FunctionCallPart]s. + * + * @property functionIds A list of `id`s matching the `id` provided in a previous + * [LiveServerToolCall], where only the provided `id`s should be cancelled. + */ +@PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public class LiveServerToolCallCancellation(public val functionIds: List) : + LiveServerMessage { + @Serializable internal data class Internal(val functionIds: List = emptyList()) + @Serializable + internal data class InternalWrapper(val toolCallCancellation: Internal) : + InternalLiveServerMessage { + override fun toPublic() = LiveServerToolCallCancellation(toolCallCancellation.functionIds) + } +} + +@PublicPreviewAPI +@Serializable(LiveServerMessageSerializer::class) +internal sealed interface InternalLiveServerMessage { + fun toPublic(): LiveServerMessage +} + +@OptIn(PublicPreviewAPI::class) +internal object LiveServerMessageSerializer : + JsonContentPolymorphicSerializer(InternalLiveServerMessage::class) { + @OptIn(PublicPreviewAPI::class) + override fun selectDeserializer( + element: JsonElement + ): DeserializationStrategy { + val jsonObject = element.jsonObject + return when { + "serverContent" in jsonObject -> LiveServerContent.InternalWrapper.serializer() + "setupComplete" in jsonObject -> LiveServerSetupComplete.Internal.serializer() + "toolCall" in jsonObject -> LiveServerToolCall.InternalWrapper.serializer() + "toolCallCancellation" in jsonObject -> + LiveServerToolCallCancellation.InternalWrapper.serializer() + else -> + throw SerializationException( + "The given subclass of LiveServerMessage (${javaClass.simpleName}) is not supported in the serialization yet." + ) + } + } +} diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveSession.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveSession.kt index e7d00714548..072320674c7 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveSession.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/LiveSession.kt @@ -43,7 +43,6 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.flow.transform import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import kotlinx.coroutines.yield @@ -51,13 +50,14 @@ import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonNull -import kotlinx.serialization.json.JsonObject -import kotlinx.serialization.json.decodeFromJsonElement /** Represents a live WebSocket session capable of streaming content to and from the server. */ @PublicPreviewAPI @OptIn(ExperimentalSerializationApi::class) +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class LiveSession internal constructor( private val session: ClientWebSocketSession, @@ -140,13 +140,13 @@ internal constructor( * * Call [close] to stop receiving responses from the model. * - * @return A [Flow] which will emit [LiveContentResponse] from the model. + * @return A [Flow] which will emit [LiveServerMessage] from the model. * * @throws [SessionAlreadyReceivingException] when the session is already receiving. * @see stopReceiving */ - public fun receive(): Flow { - return FirebaseVertexAIException.catch { + public fun receive(): Flow = + FirebaseVertexAIException.catch { if (startedReceiving.getAndSet(true)) { throw SessionAlreadyReceivingException() } @@ -157,8 +157,14 @@ internal constructor( val response = session.incoming.tryReceive() if (response.isClosed || !startedReceiving.get()) break - val frame = response.getOrNull() - frame?.let { frameToLiveContentResponse(it) }?.let { emit(it) } + response + .getOrNull() + ?.let { + JSON.decodeFromString( + it.readBytes().toString(Charsets.UTF_8) + ) + } + ?.let { emit(it.toPublic()) } yield() } @@ -167,14 +173,7 @@ internal constructor( .catch { throw FirebaseVertexAIException.from(it) } // TODO(b/410059569): Add back when fixed - // return session.incoming.receiveAsFlow().transform { frame -> - // val response = frameToLiveContentResponse(frame) - // response?.let { emit(it) } - // }.onCompletion { - // stopAudioConversation() - // }.catch { throw FirebaseVertexAIException.from(it) } } - } /** * Stops receiving from the model. @@ -309,30 +308,48 @@ internal constructor( functionCallHandler: ((FunctionCallPart) -> FunctionResponsePart)? ) { receive() - .transform { - if (it.interrupted == true) { - playBackQueue.clear() - } else { - emit(it) - } - } .onEach { - if (!it.functionCalls.isNullOrEmpty()) { - if (functionCallHandler != null) { - // It's fine to suspend here since you can't have a function call running concurrently - // with an audio response - sendFunctionResponse(it.functionCalls.map(functionCallHandler).toList()) - } else { + when (it) { + is LiveServerToolCall -> { + if (it.functionCalls.isEmpty()) { + Log.w( + TAG, + "The model sent a tool call request, but it was missing functions to call." + ) + } else if (functionCallHandler != null) { + // It's fine to suspend here since you can't have a function call running concurrently + // with an audio response + sendFunctionResponse(it.functionCalls.map(functionCallHandler).toList()) + } else { + Log.w( + TAG, + "Function calls were present in the response, but a functionCallHandler was not provided." + ) + } + } + is LiveServerToolCallCancellation -> { Log.w( TAG, - "Function calls were present in the response, but a functionCallHandler was not provided." + "The model sent a tool cancellation request, but tool cancellation is not supported when using startAudioConversation()." + ) + } + is LiveServerContent -> { + if (it.interrupted) { + playBackQueue.clear() + } else { + val audioParts = it.content?.parts?.filterIsInstance().orEmpty() + for (part in audioParts) { + playBackQueue.add(part.inlineData) + } + } + } + is LiveServerSetupComplete -> { + // we should only get this message when we initially `connect` in LiveGenerativeModel + Log.w( + TAG, + "The model sent LiveServerSetupComplete after the connection was established." ) } - } - - val audioParts = it.data?.parts?.filterIsInstance().orEmpty() - for (part in audioParts) { - playBackQueue.add(part.inlineData) } } .launchIn(scope) @@ -368,50 +385,6 @@ internal constructor( } } - /** - * Converts a [Frame] from the model to a valid [LiveContentResponse], if possible. - * - * @return The corresponding [LiveContentResponse] or null if it couldn't be converted. - */ - private fun frameToLiveContentResponse(frame: Frame): LiveContentResponse? { - val jsonMessage = Json.parseToJsonElement(frame.readBytes().toString(Charsets.UTF_8)) - - if (jsonMessage !is JsonObject) { - Log.w(TAG, "Server response was not a JsonObject: $jsonMessage") - return null - } - - return when { - "toolCall" in jsonMessage -> { - val functionContent = - JSON.decodeFromJsonElement(jsonMessage) - LiveContentResponse( - null, - null, - null, - functionContent.toolCall.functionCalls.map { - FunctionCallPart(it.name, it.args.orEmpty().mapValues { x -> x.value ?: JsonNull }) - } - ) - } - "serverContent" in jsonMessage -> { - val serverContent = - JSON.decodeFromJsonElement(jsonMessage) - .serverContent - LiveContentResponse( - serverContent.modelTurn?.toPublic(), - serverContent.interrupted, - serverContent.turnComplete, - null - ) - } - else -> { - Log.w(TAG, "Failed to decode the server response: $jsonMessage") - null - } - } - } - /** * Incremental update of the current conversation delivered from the client. * @@ -433,51 +406,7 @@ internal constructor( fun toInternal() = Internal(Internal.BidiGenerateContentClientContent(turns, turnComplete)) } - /** - * Incremental server update generated by the model in response to client messages. - * - * Effectively, a message from the model to the client. - */ - internal class BidiGenerateContentServerContentSetup( - val modelTurn: Content.Internal?, - val turnComplete: Boolean?, - val interrupted: Boolean? - ) { - @Serializable - internal class Internal(val serverContent: BidiGenerateContentServerContent) { - @Serializable - internal data class BidiGenerateContentServerContent( - val modelTurn: Content.Internal?, - val turnComplete: Boolean?, - val interrupted: Boolean? - ) - } - - fun toInternal() = - Internal(Internal.BidiGenerateContentServerContent(modelTurn, turnComplete, interrupted)) - } - - /** - * Request for the client to execute the provided function calls and return the responses with the - * matched `id`s. - */ - internal data class BidiGenerateContentToolCallSetup( - val functionCalls: List - ) { - @Serializable - internal class Internal(val toolCall: BidiGenerateContentToolCall) { - @Serializable - internal data class BidiGenerateContentToolCall( - val functionCalls: List - ) - } - - fun toInternal(): Internal { - return Internal(Internal.BidiGenerateContentToolCall(functionCalls)) - } - } - - /** Client generated responses to a [BidiGenerateContentToolCallSetup]. */ + /** Client generated responses to a [LiveServerToolCall]. */ internal class BidiGenerateContentToolResponseSetup( val functionResponses: List ) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/MediaData.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/MediaData.kt index 7e58c9cf43c..3b3b38f89f3 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/MediaData.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/MediaData.kt @@ -27,6 +27,10 @@ import kotlinx.serialization.Serializable * [Firebase documentation](https://firebase.google.com/docs/vertex-ai/input-file-requirements). */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class MediaData(public val data: ByteArray, public val mimeType: String) { @Serializable internal class Internal( diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ModalityTokenCount.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ModalityTokenCount.kt index 16b7b1e4207..0bb6de78baf 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ModalityTokenCount.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ModalityTokenCount.kt @@ -24,6 +24,10 @@ import kotlinx.serialization.Serializable * @property modality The modality associated with this token count. * @property tokenCount The number of tokens counted. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ModalityTokenCount private constructor(public val modality: ContentModality, public val tokenCount: Int) { diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt index cb8c22d4b9f..833065074e6 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt @@ -31,9 +31,17 @@ import kotlinx.serialization.json.jsonObject import org.json.JSONObject /** Interface representing data sent to and received from requests. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public interface Part {} /** Represents text or string based data sent to and received from requests. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class TextPart(public val text: String) : Part { @Serializable internal data class Internal(val text: String) : InternalPart @@ -45,6 +53,10 @@ public class TextPart(public val text: String) : Part { * * @param image [Bitmap] to convert into a [Part] */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ImagePart(public val image: Bitmap) : Part { internal fun toInlineDataPart() = @@ -61,6 +73,10 @@ public class ImagePart(public val image: Bitmap) : Part { * @param mimeType an IANA standard MIME type. For supported values, see the * [Vertex AI documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/send-multimodal-prompts#media_requirements) */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class InlineDataPart(public val inlineData: ByteArray, public val mimeType: String) : Part { @Serializable @@ -77,38 +93,65 @@ public class InlineDataPart(public val inlineData: ByteArray, public val mimeTyp * * @param name the name of the function to call * @param args the function parameters and values as a [Map] + * @param id Unique id of the function call. If present, the returned [FunctionResponsePart] should + * have a matching `id` field. */ -// TODO(b/410040441): Support id property -public class FunctionCallPart( +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public class FunctionCallPart +@JvmOverloads +constructor( public val name: String, public val args: Map, + public val id: String? = null ) : Part { @Serializable internal data class Internal(val functionCall: FunctionCall) : InternalPart { @Serializable - internal data class FunctionCall(val name: String, val args: Map? = null) + internal data class FunctionCall( + val name: String, + val args: Map? = null, + val id: String? = null + ) } } /** * Represents function call output to be returned to the model when it requests a function call. * - * @param name the name of the called function - * @param response the response produced by the function as a [JSONObject] + * @param name The name of the called function. + * @param response The response produced by the function as a [JSONObject]. + * @param id Matching `id` for a [FunctionCallPart], if one was provided. */ -// TODO(b/410040441): Support id property -public class FunctionResponsePart(public val name: String, public val response: JsonObject) : Part { +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) +public class FunctionResponsePart +@JvmOverloads +constructor( + public val name: String, + public val response: JsonObject, + public val id: String? = null +) : Part { @Serializable internal data class Internal(val functionResponse: FunctionResponse) : InternalPart { - @Serializable internal data class FunctionResponse(val name: String, val response: JsonObject) + @Serializable + internal data class FunctionResponse( + val name: String, + val response: JsonObject, + val id: String? = null + ) } internal fun toInternalFunctionCall(): Internal.FunctionResponse { - return Internal.FunctionResponse(this.name, this.response) + return Internal.FunctionResponse(name, response, id) } } @@ -120,6 +163,10 @@ public class FunctionResponsePart(public val name: String, public val response: * @param mimeType an IANA standard MIME type. For supported MIME type values see the * [Firebase documentation](https://firebase.google.com/docs/vertex-ai/input-file-requirements). */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class FileDataPart(public val uri: String, public val mimeType: String) : Part { @Serializable @@ -181,9 +228,11 @@ internal fun Part.toInternal(): InternalPart { ) ) is FunctionCallPart -> - FunctionCallPart.Internal(FunctionCallPart.Internal.FunctionCall(name, args)) + FunctionCallPart.Internal(FunctionCallPart.Internal.FunctionCall(name, args, id)) is FunctionResponsePart -> - FunctionResponsePart.Internal(FunctionResponsePart.Internal.FunctionResponse(name, response)) + FunctionResponsePart.Internal( + FunctionResponsePart.Internal.FunctionResponse(name, response, id) + ) is FileDataPart -> FileDataPart.Internal(FileDataPart.Internal.FileData(mimeType = mimeType, fileUri = uri)) else -> @@ -214,13 +263,11 @@ internal fun InternalPart.toPublic(): Part { is FunctionCallPart.Internal -> FunctionCallPart( functionCall.name, - functionCall.args.orEmpty().mapValues { it.value ?: JsonNull } + functionCall.args.orEmpty().mapValues { it.value ?: JsonNull }, + functionCall.id ) is FunctionResponsePart.Internal -> - FunctionResponsePart( - functionResponse.name, - functionResponse.response, - ) + FunctionResponsePart(functionResponse.name, functionResponse.response, functionResponse.id) is FileDataPart.Internal -> FileDataPart(fileData.mimeType, fileData.fileUri) else -> throw com.google.firebase.vertexai.type.SerializationException( diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/PromptFeedback.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/PromptFeedback.kt index f7e1ad0948a..c7a57628a64 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/PromptFeedback.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/PromptFeedback.kt @@ -28,6 +28,10 @@ import kotlinx.serialization.Serializable * @param safetyRatings A list of relevant [SafetyRating]. * @param blockReasonMessage A message describing the reason that content was blocked, if any. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class PromptFeedback( public val blockReason: BlockReason?, public val safetyRatings: List, @@ -42,13 +46,17 @@ public class PromptFeedback( ) { internal fun toPublic(): PromptFeedback { - val safetyRatings = safetyRatings?.map { it.toPublic() }.orEmpty() + val safetyRatings = safetyRatings?.mapNotNull { it.toPublic() }.orEmpty() return PromptFeedback(blockReason?.toPublic(), safetyRatings, blockReasonMessage) } } } /** Describes why content was blocked. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class BlockReason private constructor(public val name: String, public val ordinal: Int) { @Serializable(Internal.Serializer::class) diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/RequestOptions.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/RequestOptions.kt index 9aa648b6d07..4d129d2acaf 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/RequestOptions.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/RequestOptions.kt @@ -22,6 +22,10 @@ import kotlin.time.DurationUnit import kotlin.time.toDuration /** Configurable options unique to how requests to the backend are performed. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class RequestOptions internal constructor( internal val timeout: Duration, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ResponseModality.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ResponseModality.kt index 09343755216..455dbb1d466 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ResponseModality.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ResponseModality.kt @@ -21,6 +21,10 @@ import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable /** Represents the type of content present in a response (e.g., text, image, audio). */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ResponseModality private constructor(public val ordinal: Int) { @Serializable(Internal.Serializer::class) diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt index 8095c42c532..168b74b680c 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SafetySetting.kt @@ -27,6 +27,10 @@ import kotlinx.serialization.Serializable * @param method Specify if the threshold is used for probability or severity score, if not * specified it will default to [HarmBlockMethod.PROBABILITY]. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class SafetySetting( internal val harmCategory: HarmCategory, internal val threshold: HarmBlockThreshold, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Schema.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Schema.kt index 869d83b0eb9..160a5841321 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Schema.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Schema.kt @@ -18,7 +18,15 @@ package com.google.firebase.vertexai.type import kotlinx.serialization.Serializable +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public abstract class StringFormat private constructor(internal val value: String) { + @Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" + ) public class Custom(value: String) : StringFormat(value) } @@ -32,6 +40,10 @@ public abstract class StringFormat private constructor(internal val value: Strin * encouraged. The more information the model has about what it's expected to generate, the better * the results. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class Schema internal constructor( public val type: String, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SpeechConfig.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SpeechConfig.kt index b058cb01ef2..a81a3c365fb 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SpeechConfig.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/SpeechConfig.kt @@ -21,6 +21,10 @@ import kotlinx.serialization.Serializable /** Speech configuration class for setting up the voice of the server's response. */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class SpeechConfig( /** The voice to be used for the server's speech response. */ public val voice: Voices diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Tool.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Tool.kt index e62e02f55b1..caf3f229763 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Tool.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Tool.kt @@ -25,6 +25,10 @@ import kotlinx.serialization.json.JsonObject * * @param functionDeclarations The set of functions that this tool allows the model access to */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class Tool internal constructor(internal val functionDeclarations: List?) { internal fun toInternal() = Internal(functionDeclarations?.map { it.toInternal() } ?: emptyList()) diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ToolConfig.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ToolConfig.kt index 99769ed46b6..631e6b98f46 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ToolConfig.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/ToolConfig.kt @@ -25,6 +25,10 @@ import kotlinx.serialization.Serializable * * @param functionCallingConfig The config for function calling */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class ToolConfig(internal val functionCallingConfig: FunctionCallingConfig?) { internal fun toInternal() = diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/UsageMetadata.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/UsageMetadata.kt index 16200792f9c..8ed4fcc4177 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/UsageMetadata.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/UsageMetadata.kt @@ -29,6 +29,10 @@ import kotlinx.serialization.Serializable * @param candidatesTokensDetails The breakdown, by modality, of how many tokens are consumed by the * candidates. */ +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class UsageMetadata( public val promptTokenCount: Int, public val candidatesTokenCount: Int?, diff --git a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Voices.kt b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Voices.kt index b0bade40957..f4c6470fc41 100644 --- a/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Voices.kt +++ b/firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Voices.kt @@ -21,6 +21,10 @@ import kotlinx.serialization.Serializable /** Various voices supported by the server */ @PublicPreviewAPI +@Deprecated( + """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. +For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk""" +) public class Voices private constructor(public val ordinal: Int) { @Serializable internal data class Internal(@SerialName("voice_name") val voiceName: String) diff --git a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIStreamingSnapshotTests.kt b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIStreamingSnapshotTests.kt index 981144a8e14..05090264292 100644 --- a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIStreamingSnapshotTests.kt +++ b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIStreamingSnapshotTests.kt @@ -36,7 +36,10 @@ import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.toList import kotlinx.coroutines.withTimeout import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +@RunWith(RobolectricTestRunner::class) internal class VertexAIStreamingSnapshotTests { private val testTimeout = 5.seconds @@ -62,14 +65,25 @@ internal class VertexAIStreamingSnapshotTests { withTimeout(testTimeout) { val responseList = responses.toList() responseList.isEmpty() shouldBe false - responseList.forEach { - it.candidates.first().finishReason shouldBe FinishReason.STOP - it.candidates.first().content.parts.isEmpty() shouldBe false - it.candidates.first().safetyRatings.isEmpty() shouldBe false + responseList.last().candidates.first().apply { + finishReason shouldBe FinishReason.STOP + content.parts.isEmpty() shouldBe false } } } + @Test + fun `invalid safety ratings during image generation`() = + goldenVertexStreamingFile("streaming-success-image-invalid-safety-ratings.txt") { + val responses = model.generateContentStream("prompt") + + withTimeout(testTimeout) { + val responseList = responses.toList() + + responseList.isEmpty() shouldBe false + } + } + @Test fun `unknown enum in safety ratings`() = goldenVertexStreamingFile("streaming-success-unknown-safety-enum.txt") { diff --git a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIUnarySnapshotTests.kt b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIUnarySnapshotTests.kt index f3603814423..527b4fc4876 100644 --- a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIUnarySnapshotTests.kt +++ b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/VertexAIUnarySnapshotTests.kt @@ -55,8 +55,11 @@ import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive import org.json.JSONArray import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner @OptIn(PublicPreviewAPI::class) +@RunWith(RobolectricTestRunner::class) internal class VertexAIUnarySnapshotTests { private val testTimeout = 5.seconds @@ -125,6 +128,16 @@ internal class VertexAIUnarySnapshotTests { } } + @Test + fun `invalid safety ratings during image generation`() = + goldenVertexUnaryFile("unary-success-image-invalid-safety-ratings.json") { + withTimeout(testTimeout) { + val response = model.generateContent("prompt") + + response.candidates.isEmpty() shouldBe false + } + } + @Test fun `unknown enum in finish reason`() = goldenVertexUnaryFile("unary-failure-unknown-enum-finish-reason.json") { diff --git a/firebase-vertexai/src/testUtil/java/com/google/firebase/vertexai/JavaCompileTests.java b/firebase-vertexai/src/testUtil/java/com/google/firebase/vertexai/JavaCompileTests.java index cf71db18798..8f2020d818f 100644 --- a/firebase-vertexai/src/testUtil/java/com/google/firebase/vertexai/JavaCompileTests.java +++ b/firebase-vertexai/src/testUtil/java/com/google/firebase/vertexai/JavaCompileTests.java @@ -44,8 +44,12 @@ import com.google.firebase.vertexai.type.HarmSeverity; import com.google.firebase.vertexai.type.ImagePart; import com.google.firebase.vertexai.type.InlineDataPart; -import com.google.firebase.vertexai.type.LiveContentResponse; import com.google.firebase.vertexai.type.LiveGenerationConfig; +import com.google.firebase.vertexai.type.LiveServerContent; +import com.google.firebase.vertexai.type.LiveServerMessage; +import com.google.firebase.vertexai.type.LiveServerSetupComplete; +import com.google.firebase.vertexai.type.LiveServerToolCall; +import com.google.firebase.vertexai.type.LiveServerToolCallCancellation; import com.google.firebase.vertexai.type.MediaData; import com.google.firebase.vertexai.type.ModalityTokenCount; import com.google.firebase.vertexai.type.Part; @@ -276,14 +280,14 @@ private void testLiveFutures(LiveModelFutures futures) throws Exception { session .receive() .subscribe( - new Subscriber() { + new Subscriber() { @Override public void onSubscribe(Subscription s) { s.request(Long.MAX_VALUE); } @Override - public void onNext(LiveContentResponse response) { + public void onNext(LiveServerMessage response) { validateLiveContentResponse(response); } @@ -315,17 +319,22 @@ public void onComplete() { session.close(); } - private void validateLiveContentResponse(LiveContentResponse response) { - // int status = response.getStatus(); - // Assert.assertEquals(status, LiveContentResponse.Status.Companion.getNORMAL()); - // Assert.assertNotEquals(status, LiveContentResponse.Status.Companion.getINTERRUPTED()); - // Assert.assertNotEquals(status, LiveContentResponse.Status.Companion.getTURN_COMPLETE()); - // TODO b/412743328 LiveContentResponse.Status inaccessible for Java users - Content data = response.getData(); - if (data != null) { - validateContent(data); + private void validateLiveContentResponse(LiveServerMessage message) { + if (message instanceof LiveServerContent) { + LiveServerContent content = (LiveServerContent) message; + validateContent(content.getContent()); + boolean complete = content.getGenerationComplete(); + boolean interrupted = content.getInterrupted(); + boolean turnComplete = content.getTurnComplete(); + } else if (message instanceof LiveServerSetupComplete) { + LiveServerSetupComplete setup = (LiveServerSetupComplete) message; + // No methods + } else if (message instanceof LiveServerToolCall) { + LiveServerToolCall call = (LiveServerToolCall) message; + validateFunctionCalls(call.getFunctionCalls()); + } else if (message instanceof LiveServerToolCallCancellation) { + LiveServerToolCallCancellation cancel = (LiveServerToolCallCancellation) message; + List functions = cancel.getFunctionIds(); } - String text = response.getText(); - validateFunctionCalls(response.getFunctionCalls()); } } diff --git a/firebase-vertexai/update_responses.sh b/firebase-vertexai/update_responses.sh index 28b0be1a25a..7d6ea18e0ee 100755 --- a/firebase-vertexai/update_responses.sh +++ b/firebase-vertexai/update_responses.sh @@ -17,7 +17,7 @@ # This script replaces mock response files for Vertex AI unit tests with a fresh # clone of the shared repository of Vertex AI test data. -RESPONSES_VERSION='v7.*' # The major version of mock responses to use +RESPONSES_VERSION='v13.*' # The major version of mock responses to use REPO_NAME="vertexai-sdk-test-data" REPO_LINK="https://github.com/FirebaseExtended/$REPO_NAME.git"