diff --git a/.github/workflows/check-vertexai-responses.yml b/.github/workflows/check-firebaseai-responses.yml similarity index 77% rename from .github/workflows/check-vertexai-responses.yml rename to .github/workflows/check-firebaseai-responses.yml index 360a277db74..80d43bb81fe 100644 --- a/.github/workflows/check-vertexai-responses.yml +++ b/.github/workflows/check-firebaseai-responses.yml @@ -1,4 +1,4 @@ -name: Check Vertex AI Responses +name: Check Firebase AI Responses on: pull_request @@ -10,30 +10,30 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Clone mock responses - run: firebase-vertexai/update_responses.sh + run: firebase-ai/update_responses.sh - name: Find cloned and latest versions run: | CLONED=$(git describe --tags) LATEST=$(git tag --sort=v:refname | tail -n1) echo "cloned_tag=$CLONED" >> $GITHUB_ENV echo "latest_tag=$LATEST" >> $GITHUB_ENV - working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data + working-directory: firebase-ai/src/test/resources/vertexai-sdk-test-data - name: Find comment from previous run if exists uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 id: fc with: issue-number: ${{github.event.number}} - body-includes: Vertex AI Mock Responses Check + body-includes: Firebase AI Mock Responses Check - name: Comment on PR if newer version is available if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}} uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 with: issue-number: ${{github.event.number}} body: > - ### Vertex AI Mock Responses Check :warning: + ### Firebase AI Mock Responses Check :warning: - A newer major version of the mock responses for Vertex AI unit tests is available. - [update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh) + A newer major version of the mock responses for Firebase AI unit tests is available. + [update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-ai/update_responses.sh) should be updated to clone the latest version of the responses: `${{env.latest_tag}}` - name: Delete comment when version gets updated if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}} diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 543425ab14a..247157caeef 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -66,6 +66,12 @@ jobs: with: node-version: ${{ env.FDC_NODEJS_VERSION }} + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + with: + python-version: ${{ env.FDC_PYTHON_VERSION }} + + - run: pip install -r firebase-dataconnect/ci/requirements.txt + - name: Install Firebase Tools ("firebase" command-line tool) run: | set -euo pipefail @@ -229,6 +235,15 @@ jobs: if: steps.connectedCheck.outcome != 'success' run: | set -euo pipefail + + if [[ ! -e logcat.log ]] ; then + echo "WARNING dsdta43sxk: logcat log file not found; skipping scanning for test failures" >&2 + else + echo "Scanning logcat output for failure details" + python firebase-dataconnect/ci/logcat_error_report.py --logcat-file=logcat.log + echo + fi + echo 'Failing because the outcome of the "Gradle connectedCheck" step ("${{ steps.connectedCheck.outcome }}") was not successful' exit 1 diff --git a/firebase-ai/CHANGELOG.md b/firebase-ai/CHANGELOG.md index a0018bd9fa0..8d26e6850f1 100644 --- a/firebase-ai/CHANGELOG.md +++ b/firebase-ai/CHANGELOG.md @@ -1,4 +1,5 @@ # Unreleased +* [fixed] **Breaking Change**: Fixed missing builder methods and return types in builders. * [changed] **Breaking Change**: `LiveModelFutures.connect` now returns `ListenableFuture` instead of `ListenableFuture`. * **Action Required:** Remove any transformations from LiveSession object to LiveSessionFutures object. * **Action Required:** Change type of variable handling `LiveModelFutures.connect` to `ListenableFuture` diff --git a/firebase-ai/api.txt b/firebase-ai/api.txt index d16c1904e6b..c9d55f52295 100644 --- a/firebase-ai/api.txt +++ b/firebase-ai/api.txt @@ -216,12 +216,10 @@ package com.google.firebase.ai.type { method public com.google.firebase.ai.type.Content.Builder addPart(T data); method public com.google.firebase.ai.type.Content.Builder addText(String text); method public com.google.firebase.ai.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; + method public com.google.firebase.ai.type.Content.Builder setParts(java.util.List parts); + method public com.google.firebase.ai.type.Content.Builder setRole(String? role); + field public java.util.List parts; + field public String? role; } public final class ContentBlockedException extends com.google.firebase.ai.type.FirebaseAIException { @@ -355,6 +353,17 @@ package com.google.firebase.ai.type { public static final class GenerationConfig.Builder { ctor public GenerationConfig.Builder(); method public com.google.firebase.ai.type.GenerationConfig build(); + method public com.google.firebase.ai.type.GenerationConfig.Builder setCandidateCount(Integer? candidateCount); + method public com.google.firebase.ai.type.GenerationConfig.Builder setFrequencyPenalty(Float? frequencyPenalty); + method public com.google.firebase.ai.type.GenerationConfig.Builder setMaxOutputTokens(Integer? maxOutputTokens); + method public com.google.firebase.ai.type.GenerationConfig.Builder setPresencePenalty(Float? presencePenalty); + method public com.google.firebase.ai.type.GenerationConfig.Builder setResponseMimeType(String? responseMimeType); + method public com.google.firebase.ai.type.GenerationConfig.Builder setResponseModalities(java.util.List? responseModalities); + method public com.google.firebase.ai.type.GenerationConfig.Builder setResponseSchema(com.google.firebase.ai.type.Schema? responseSchema); + method public com.google.firebase.ai.type.GenerationConfig.Builder setStopSequences(java.util.List? stopSequences); + method public com.google.firebase.ai.type.GenerationConfig.Builder setTemperature(Float? temperature); + method public com.google.firebase.ai.type.GenerationConfig.Builder setTopK(Integer? topK); + method public com.google.firebase.ai.type.GenerationConfig.Builder setTopP(Float? topP); field public Integer? candidateCount; field public Float? frequencyPenalty; field public Integer? maxOutputTokens; diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/common/APIController.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/common/APIController.kt index a0287c161c2..34a4b96b7dd 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/common/APIController.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/common/APIController.kt @@ -164,7 +164,8 @@ 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 ): Flow = @@ -190,12 +191,7 @@ internal constructor( throw FirebaseCommonAIException.from(e) } - private fun HttpRequestBuilder.applyCommonConfiguration(request: Request) { - when (request) { - is GenerateContentRequest -> setBody(request) - is CountTokensRequest -> setBody(request) - is GenerateImageRequest -> setBody(request) - } + private fun HttpRequestBuilder.applyCommonHeaders() { contentType(ContentType.Application.Json) header("x-goog-api-key", key) header("x-goog-api-client", apiClient) @@ -204,6 +200,14 @@ internal constructor( header("X-Firebase-AppVersion", appVersion) } } + private fun HttpRequestBuilder.applyCommonConfiguration(request: Request) { + when (request) { + is GenerateContentRequest -> setBody(request) + is CountTokensRequest -> setBody(request) + is GenerateImageRequest -> setBody(request) + } + applyCommonHeaders() + } private suspend fun HttpRequestBuilder.applyHeaderProvider() { if (headerProvider != null) { diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt index a95231b583e..d5fc51f21c0 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt @@ -51,7 +51,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() @@ -120,8 +120,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 +129,22 @@ 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 + ) + } } } diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Content.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Content.kt index b1ba8c066cb..4e9f1a860db 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Content.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Content.kt @@ -44,14 +44,17 @@ constructor(public val role: String? = "user", public val parts: List) { public class Builder { /** The producer of the content. Must be either 'user' or 'model'. By default, it's "user". */ - public var role: String? = "user" + @JvmField public var role: String? = "user" /** * The mutable list of [Part]s comprising the [Content]. * * Prefer using the provided helper methods over modifying this list directly. */ - public var parts: MutableList = arrayListOf() + @JvmField public var parts: MutableList = arrayListOf() + + public fun setRole(role: String?): Content.Builder = apply { this.role = role } + public fun setParts(parts: MutableList): Content.Builder = apply { this.parts = parts } /** Adds a new [Part] to [parts]. */ @JvmName("addPart") diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GenerationConfig.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GenerationConfig.kt index 0b6e49450a5..1c2d2680bb1 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GenerationConfig.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GenerationConfig.kt @@ -136,6 +136,36 @@ private constructor( @JvmField public var responseSchema: Schema? = null @JvmField public var responseModalities: List? = null + public fun setTemperature(temperature: Float?): Builder = apply { + this.temperature = temperature + } + public fun setTopK(topK: Int?): Builder = apply { this.topK = topK } + public fun setTopP(topP: Float?): Builder = apply { this.topP = topP } + public fun setCandidateCount(candidateCount: Int?): Builder = apply { + this.candidateCount = candidateCount + } + public fun setMaxOutputTokens(maxOutputTokens: Int?): Builder = apply { + this.maxOutputTokens = maxOutputTokens + } + public fun setPresencePenalty(presencePenalty: Float?): Builder = apply { + this.presencePenalty = presencePenalty + } + public fun setFrequencyPenalty(frequencyPenalty: Float?): Builder = apply { + this.frequencyPenalty = frequencyPenalty + } + public fun setStopSequences(stopSequences: List?): Builder = apply { + this.stopSequences = stopSequences + } + public fun setResponseMimeType(responseMimeType: String?): Builder = apply { + this.responseMimeType = responseMimeType + } + public fun setResponseSchema(responseSchema: Schema?): Builder = apply { + this.responseSchema = responseSchema + } + public fun setResponseModalities(responseModalities: List?): Builder = apply { + this.responseModalities = responseModalities + } + /** Create a new [GenerationConfig] with the attached arguments. */ public fun build(): GenerationConfig = GenerationConfig( diff --git a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/PromptFeedback.kt b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/PromptFeedback.kt index 817d1358f67..5f9840263eb 100644 --- a/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/PromptFeedback.kt +++ b/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/PromptFeedback.kt @@ -42,7 +42,7 @@ 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) } } diff --git a/firebase-ai/src/test/java/com/google/firebase/ai/DevAPIStreamingSnapshotTests.kt b/firebase-ai/src/test/java/com/google/firebase/ai/DevAPIStreamingSnapshotTests.kt index fde573fd634..967254a096c 100644 --- a/firebase-ai/src/test/java/com/google/firebase/ai/DevAPIStreamingSnapshotTests.kt +++ b/firebase-ai/src/test/java/com/google/firebase/ai/DevAPIStreamingSnapshotTests.kt @@ -42,9 +42,10 @@ internal class DevAPIStreamingSnapshotTests { withTimeout(testTimeout) { val responseList = responses.toList() responseList.isEmpty() shouldBe false - responseList.first().candidates.first().finishReason shouldBe FinishReason.STOP - responseList.first().candidates.first().content.parts.isEmpty() shouldBe false - responseList.first().candidates.first().safetyRatings.isEmpty() shouldBe false + responseList.last().candidates.first().apply { + finishReason shouldBe FinishReason.STOP + content.parts.isEmpty() shouldBe false + } } } @@ -56,10 +57,9 @@ internal class DevAPIStreamingSnapshotTests { 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 } } } diff --git a/firebase-ai/src/test/java/com/google/firebase/ai/VertexAIStreamingSnapshotTests.kt b/firebase-ai/src/test/java/com/google/firebase/ai/VertexAIStreamingSnapshotTests.kt index e5a58541123..e6331401fde 100644 --- a/firebase-ai/src/test/java/com/google/firebase/ai/VertexAIStreamingSnapshotTests.kt +++ b/firebase-ai/src/test/java/com/google/firebase/ai/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 @@ -48,9 +51,11 @@ internal class VertexAIStreamingSnapshotTests { withTimeout(testTimeout) { val responseList = responses.toList() responseList.isEmpty() shouldBe false - responseList.first().candidates.first().finishReason shouldBe FinishReason.STOP - responseList.first().candidates.first().content.parts.isEmpty() shouldBe false - responseList.first().candidates.first().safetyRatings.isEmpty() shouldBe false + responseList.last().candidates.first().apply { + finishReason shouldBe FinishReason.STOP + content.parts.isEmpty() shouldBe false + safetyRatings.isEmpty() shouldBe false + } } } @@ -62,10 +67,9 @@ 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 } } } @@ -85,6 +89,18 @@ internal class VertexAIStreamingSnapshotTests { } } + @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 finish reason`() = goldenVertexStreamingFile("streaming-failure-unknown-finish-enum.txt") { diff --git a/firebase-ai/src/test/java/com/google/firebase/ai/VertexAIUnarySnapshotTests.kt b/firebase-ai/src/test/java/com/google/firebase/ai/VertexAIUnarySnapshotTests.kt index a19339b4981..ca1d279d288 100644 --- a/firebase-ai/src/test/java/com/google/firebase/ai/VertexAIUnarySnapshotTests.kt +++ b/firebase-ai/src/test/java/com/google/firebase/ai/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-ai/src/test/java/com/google/firebase/ai/util/tests.kt b/firebase-ai/src/test/java/com/google/firebase/ai/util/tests.kt index dff254b7adf..393a2a16adc 100644 --- a/firebase-ai/src/test/java/com/google/firebase/ai/util/tests.kt +++ b/firebase-ai/src/test/java/com/google/firebase/ai/util/tests.kt @@ -39,7 +39,7 @@ import java.io.File import kotlinx.coroutines.launch import org.mockito.Mockito -private val TEST_CLIENT_ID = "firebase-vertexai-android/test" +private val TEST_CLIENT_ID = "firebase-ai-android/test" private val TEST_APP_ID = "1:android:12345" private val TEST_VERSION = 1 @@ -193,7 +193,7 @@ internal fun goldenDevAPIStreamingFile( name: String, httpStatusCode: HttpStatusCode = HttpStatusCode.OK, block: CommonTest, -) = goldenStreamingFile("vertexai/$name", httpStatusCode, GenerativeBackend.googleAI(), block) +) = goldenStreamingFile("googleai/$name", httpStatusCode, GenerativeBackend.googleAI(), block) /** * A variant of [commonTest] for performing snapshot tests. diff --git a/firebase-ai/src/testUtil/java/com/google/firebase/ai/JavaCompileTests.java b/firebase-ai/src/testUtil/java/com/google/firebase/ai/JavaCompileTests.java index 5e363ed95b2..0c32921d5db 100644 --- a/firebase-ai/src/testUtil/java/com/google/firebase/ai/JavaCompileTests.java +++ b/firebase-ai/src/testUtil/java/com/google/firebase/ai/JavaCompileTests.java @@ -17,11 +17,15 @@ package java.com.google.firebase.ai; import android.graphics.Bitmap; +import androidx.annotation.Nullable; import com.google.common.util.concurrent.ListenableFuture; import com.google.firebase.ai.FirebaseAI; import com.google.firebase.ai.GenerativeModel; +import com.google.firebase.ai.LiveGenerativeModel; import com.google.firebase.ai.java.ChatFutures; import com.google.firebase.ai.java.GenerativeModelFutures; +import com.google.firebase.ai.java.LiveModelFutures; +import com.google.firebase.ai.java.LiveSessionFutures; import com.google.firebase.ai.type.BlockReason; import com.google.firebase.ai.type.Candidate; import com.google.firebase.ai.type.Citation; @@ -32,25 +36,42 @@ import com.google.firebase.ai.type.FileDataPart; import com.google.firebase.ai.type.FinishReason; import com.google.firebase.ai.type.FunctionCallPart; +import com.google.firebase.ai.type.FunctionResponsePart; import com.google.firebase.ai.type.GenerateContentResponse; +import com.google.firebase.ai.type.GenerationConfig; import com.google.firebase.ai.type.HarmCategory; import com.google.firebase.ai.type.HarmProbability; import com.google.firebase.ai.type.HarmSeverity; import com.google.firebase.ai.type.ImagePart; import com.google.firebase.ai.type.InlineDataPart; +import com.google.firebase.ai.type.LiveGenerationConfig; +import com.google.firebase.ai.type.LiveServerContent; +import com.google.firebase.ai.type.LiveServerMessage; +import com.google.firebase.ai.type.LiveServerSetupComplete; +import com.google.firebase.ai.type.LiveServerToolCall; +import com.google.firebase.ai.type.LiveServerToolCallCancellation; +import com.google.firebase.ai.type.MediaData; import com.google.firebase.ai.type.ModalityTokenCount; import com.google.firebase.ai.type.Part; import com.google.firebase.ai.type.PromptFeedback; +import com.google.firebase.ai.type.PublicPreviewAPI; +import com.google.firebase.ai.type.ResponseModality; import com.google.firebase.ai.type.SafetyRating; +import com.google.firebase.ai.type.Schema; +import com.google.firebase.ai.type.SpeechConfig; import com.google.firebase.ai.type.TextPart; import com.google.firebase.ai.type.UsageMetadata; +import com.google.firebase.ai.type.Voices; import com.google.firebase.concurrent.FirebaseExecutors; +import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Map; import java.util.concurrent.Executor; +import kotlin.OptIn; import kotlinx.serialization.json.JsonElement; import kotlinx.serialization.json.JsonNull; +import kotlinx.serialization.json.JsonObject; import org.junit.Assert; import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; @@ -59,25 +80,78 @@ /** * Tests in this file exist to be compiled, not invoked */ +@OptIn(markerClass = PublicPreviewAPI.class) public class JavaCompileTests { public void initializeJava() throws Exception { FirebaseAI vertex = FirebaseAI.getInstance(); - GenerativeModel model = vertex.generativeModel("fake-model-name"); + GenerativeModel model = vertex.generativeModel("fake-model-name", getConfig()); + LiveGenerativeModel live = vertex.liveModel("fake-model-name", getLiveConfig()); GenerativeModelFutures futures = GenerativeModelFutures.from(model); + LiveModelFutures liveFutures = LiveModelFutures.from(live); testFutures(futures); + testLiveFutures(liveFutures); + } + + private GenerationConfig getConfig() { + return new GenerationConfig.Builder() + .setTopK(10) + .setTopP(11.0F) + .setTemperature(32.0F) + .setCandidateCount(1) + .setMaxOutputTokens(0xCAFEBABE) + .setFrequencyPenalty(1.0F) + .setPresencePenalty(2.0F) + .setStopSequences(List.of("foo", "bar")) + .setResponseMimeType("image/jxl") + .setResponseModalities(List.of(ResponseModality.TEXT, ResponseModality.TEXT)) + .setResponseSchema(getSchema()) + .build(); + } + + private Schema getSchema() { + return Schema.obj( + Map.of( + "foo", Schema.numInt(), + "bar", Schema.numInt("Some integer"), + "baz", Schema.numInt("Some integer", false), + "qux", Schema.numDouble(), + "quux", Schema.numFloat("Some floating point number"), + "xyzzy", Schema.array(Schema.numInt(), "A list of integers"), + "fee", Schema.numLong(), + "ber", + Schema.obj( + Map.of( + "bez", Schema.array(Schema.numDouble("Nullable double", true)), + "qez", Schema.enumeration(List.of("A", "B", "C"), "One of 3 letters"), + "qeez", Schema.str("A funny string"))))); + } + + private LiveGenerationConfig getLiveConfig() { + return new LiveGenerationConfig.Builder() + .setTopK(10) + .setTopP(11.0F) + .setTemperature(32.0F) + .setCandidateCount(1) + .setMaxOutputTokens(0xCAFEBABE) + .setFrequencyPenalty(1.0F) + .setPresencePenalty(2.0F) + .setResponseModality(ResponseModality.AUDIO) + .setSpeechConfig(new SpeechConfig(Voices.AOEDE)) + .build(); } private void testFutures(GenerativeModelFutures futures) throws Exception { Content content = new Content.Builder() + .setParts(new ArrayList<>()) .addText("Fake prompt") .addFileData("fakeuri", "image/png") .addInlineData(new byte[] {}, "text/json") .addImage(Bitmap.createBitmap(0, 0, Bitmap.Config.HARDWARE)) .addPart(new FunctionCallPart("fakeFunction", Map.of("fakeArg", JsonNull.INSTANCE))) + .setRole("user") .build(); - // TODO b/406558430 Content.Builder.setParts and Content.Builder.setRole return void Executor executor = FirebaseExecutors.directExecutor(); ListenableFuture countResponse = futures.countTokens(content); validateCountTokensResponse(countResponse.get()); @@ -159,7 +233,10 @@ public void validateCandidates(List candidates) { } } - public void validateContent(Content content) { + public void validateContent(@Nullable Content content) { + if (content == null) { + return; + } String role = content.getRole(); for (Part part : content.getParts()) { if (part instanceof TextPart) { @@ -236,4 +313,67 @@ public void validateUsageMetadata(UsageMetadata metadata) { } } } + + private void testLiveFutures(LiveModelFutures futures) throws Exception { + LiveSessionFutures session = futures.connect().get(); + session + .receive() + .subscribe( + new Subscriber() { + @Override + public void onSubscribe(Subscription s) { + s.request(Long.MAX_VALUE); + } + + @Override + public void onNext(LiveServerMessage message) { + validateLiveContentResponse(message); + } + + @Override + public void onError(Throwable t) { + // Ignore + } + + @Override + public void onComplete() { + // Also ignore + } + }); + + session.send("Fake message"); + session.send(new Content.Builder().addText("Fake message").build()); + + byte[] bytes = new byte[] {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE}; + session.sendMediaStream(List.of(new MediaData(bytes, "image/jxl"))); + + FunctionResponsePart functionResponse = + new FunctionResponsePart("myFunction", new JsonObject(Map.of())); + session.sendFunctionResponse(List.of(functionResponse, functionResponse)); + + session.startAudioConversation(part -> functionResponse); + session.startAudioConversation(); + session.stopAudioConversation(); + session.stopReceiving(); + session.close(); + } + + 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(); + } + } } diff --git a/firebase-ai/update_responses.sh b/firebase-ai/update_responses.sh index a6dea7785d4..7d6ea18e0ee 100755 --- a/firebase-ai/update_responses.sh +++ b/firebase-ai/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='v11.*' # 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" diff --git a/firebase-config/CHANGELOG.md b/firebase-config/CHANGELOG.md index ed0c9f93da6..5a16896e061 100644 --- a/firebase-config/CHANGELOG.md +++ b/firebase-config/CHANGELOG.md @@ -1,7 +1,16 @@ # Unreleased -[fixed] Fixed an issue where the connection to the real-time Remote Config backend could remain +* [fixed] Fixed `NetworkOnMainThreadException` on Android versions below 8 by disconnecting HttpURLConnection only on API levels 26 and higher. + +# 22.1.1 +* [fixed] Fixed an issue where the connection to the real-time Remote Config backend could remain open in the background. + +## Kotlin +The Kotlin extensions library transitively includes the updated +`firebase-config` library. The Kotlin extensions library has no additional +updates. + # 22.1.0 * [feature] Added support for custom signal targeting in Remote Config. Use `setCustomSignals` API for setting custom signals and use them to build custom targeting conditions in Remote Config. diff --git a/firebase-config/gradle.properties b/firebase-config/gradle.properties index 26e0ad751e6..ce23bb93a93 100644 --- a/firebase-config/gradle.properties +++ b/firebase-config/gradle.properties @@ -14,7 +14,7 @@ # limitations under the License. # -version=22.1.1 -latestReleasedVersion=22.1.0 +version=22.1.2 +latestReleasedVersion=22.1.1 android.enableUnitTestBinaryResources=true diff --git a/firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigRealtimeHttpClient.java b/firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigRealtimeHttpClient.java index ef082d21086..7be3ef97136 100644 --- a/firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigRealtimeHttpClient.java +++ b/firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigRealtimeHttpClient.java @@ -22,6 +22,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.pm.PackageManager; +import android.os.Build; import android.util.Log; import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; @@ -409,8 +410,13 @@ public void setIsInBackground(boolean isInBackground) { } // Close the connection if the app is in the background and there is an active // HttpUrlConnection. - if (isInBackground && httpURLConnection != null) { - httpURLConnection.disconnect(); + // This is now only done on Android versions >= O (API 26) because + // on older versions, background detection callbacks run on the main thread, which + // could lead to a NetworkOnMainThreadException when disconnecting the connection. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + if (isInBackground && httpURLConnection != null) { + httpURLConnection.disconnect(); + } } } } diff --git a/firebase-crashlytics-ndk/CHANGELOG.md b/firebase-crashlytics-ndk/CHANGELOG.md index a83b12613c4..b971b60b25f 100644 --- a/firebase-crashlytics-ndk/CHANGELOG.md +++ b/firebase-crashlytics-ndk/CHANGELOG.md @@ -1,4 +1,6 @@ # Unreleased + + # 19.4.3 * [changed] Updated internal Crashpad version to commit `21a20e`. diff --git a/firebase-crashlytics-ndk/gradle.properties b/firebase-crashlytics-ndk/gradle.properties index 5e690a3661f..7ef5196b4b5 100644 --- a/firebase-crashlytics-ndk/gradle.properties +++ b/firebase-crashlytics-ndk/gradle.properties @@ -1,2 +1,2 @@ -version=19.4.3 -latestReleasedVersion=19.4.2 +version=19.4.4 +latestReleasedVersion=19.4.3 diff --git a/firebase-crashlytics/CHANGELOG.md b/firebase-crashlytics/CHANGELOG.md index 65f3b86f462..145ae4a75cd 100644 --- a/firebase-crashlytics/CHANGELOG.md +++ b/firebase-crashlytics/CHANGELOG.md @@ -1,6 +1,15 @@ # Unreleased +# 19.4.3 +* [fixed] Fixed UnbufferedIoViolation [#6822] + + +## Kotlin +The Kotlin extensions library transitively includes the updated +`firebase-crashlytics` library. The Kotlin extensions library has no additional +updates. + # 19.4.2 * [changed] Internal changes to read version control info more efficiently [#6754] * [fixed] Fixed NoSuchMethodError when getting process info on Android 13 on some devices [#6720] diff --git a/firebase-crashlytics/gradle.properties b/firebase-crashlytics/gradle.properties index 5e690a3661f..7ef5196b4b5 100644 --- a/firebase-crashlytics/gradle.properties +++ b/firebase-crashlytics/gradle.properties @@ -1,2 +1,2 @@ -version=19.4.3 -latestReleasedVersion=19.4.2 +version=19.4.4 +latestReleasedVersion=19.4.3 diff --git a/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CommonUtils.java b/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CommonUtils.java index a116cf55542..d76ccbc2133 100644 --- a/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CommonUtils.java +++ b/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CommonUtils.java @@ -139,8 +139,9 @@ static Architecture getValue() { public static String streamToString(InputStream is) { // Previous code was running into this: http://code.google.com/p/android/issues/detail?id=14562 // on Android 2.3.3. The below code below does not exhibit that problem. - final java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); - return s.hasNext() ? s.next() : ""; + try (final java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A")) { + return s.hasNext() ? s.next() : ""; + } } public static String sha1(String source) { diff --git a/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsController.java b/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsController.java index da28e8708db..5a1322fc9b6 100644 --- a/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsController.java +++ b/firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsController.java @@ -661,15 +661,15 @@ private InputStream getResourceAsStream(String resource) { } private static byte[] readResource(InputStream is) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; + try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { + byte[] buffer = new byte[1024]; + int length; - while ((length = is.read(buffer)) != -1) { - out.write(buffer, 0, length); + while ((length = is.read(buffer)) != -1) { + out.write(buffer, 0, length); + } + return out.toByteArray(); } - - return out.toByteArray(); } private void finalizePreviousNativeSession(String previousSessionId) { diff --git a/firebase-dataconnect/CHANGELOG.md b/firebase-dataconnect/CHANGELOG.md index 3fb6b3e9e8f..96ed0b9cf1e 100644 --- a/firebase-dataconnect/CHANGELOG.md +++ b/firebase-dataconnect/CHANGELOG.md @@ -3,6 +3,10 @@ `FirebaseDataConnect` objects. ([#6861](https://github.com/firebase/firebase-android-sdk/pull/6861)) + +# 16.0.1 +* [changed] Internal improvements. + # 16.0.0 * [changed] DataConnectOperationException added, enabling support for partial errors; that is, any data that was received and/or was able to be decoded is diff --git a/firebase-dataconnect/ci/README.md b/firebase-dataconnect/ci/README.md index 59a36dc1aa0..8dd8c015eb9 100644 --- a/firebase-dataconnect/ci/README.md +++ b/firebase-dataconnect/ci/README.md @@ -18,5 +18,5 @@ pip install -r requirements.txt Then, run all of these presubmit checks by running the following command: ``` -ruff check && ruff format && pyright && pytest && echo 'SUCCESS!!!!!!!!!!!!!!!' +ruff check --fix && ruff format && pyright && pytest && echo 'SUCCESS!!!!!!!!!!!!!!!' ``` diff --git a/firebase-dataconnect/ci/logcat_error_report.py b/firebase-dataconnect/ci/logcat_error_report.py new file mode 100644 index 00000000000..fe316fd8a11 --- /dev/null +++ b/firebase-dataconnect/ci/logcat_error_report.py @@ -0,0 +1,175 @@ +# 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. + +from __future__ import annotations + +import argparse +import dataclasses +import logging +import pathlib +import re +import tempfile +import typing + +if typing.TYPE_CHECKING: + from _typeshed import SupportsWrite + +TEST_STARTED_TOKEN = "TestRunner: started:" # noqa: S105 +TEST_STARTED_PATTERN = r"(\W|^)" + re.escape(TEST_STARTED_TOKEN) + r"\s+(?P.*\S)" +TEST_FAILED_TOKEN = "TestRunner: failed:" # noqa: S105 +TEST_FAILED_PATTERN = r"(\W|^)" + re.escape(TEST_FAILED_TOKEN) + r"\s+(?P.*\S)" +TEST_FINISHED_TOKEN = "TestRunner: finished:" # noqa: S105 +TEST_FINISHED_PATTERN = r"(\W|^)" + re.escape(TEST_FINISHED_TOKEN) + r"\s+(?P.*\S)" + + +@dataclasses.dataclass +class TestResult: + test_name: str + output_file: pathlib.Path + passed: bool + + +def main() -> None: + args = parse_args() + logging.basicConfig(format="%(message)s", level=args.log_level) + + if args.work_dir is None: + work_temp_dir = tempfile.TemporaryDirectory("dd9rh9apdf") + work_dir = pathlib.Path(work_temp_dir.name) + logging.debug("Using temporary directory as work directory: %s", work_dir) + else: + work_temp_dir = None + work_dir = args.work_dir + logging.debug("Using specified directory as work directory: %s", work_dir) + work_dir.mkdir(parents=True, exist_ok=True) + + logging.info("Extracting test failures from %s", args.logcat_file) + test_results: list[TestResult] = [] + cur_test_result: TestResult | None = None + cur_test_result_output_file: SupportsWrite[str] | None = None + + with args.logcat_file.open("rt", encoding="utf8", errors="ignore") as logcat_file_handle: + for line in logcat_file_handle: + test_started_match = TEST_STARTED_TOKEN in line and re.search(TEST_STARTED_PATTERN, line) + if test_started_match: + test_name = test_started_match.group("name") + logging.debug('Found "Test Started" logcat line for test: %s', test_name) + if cur_test_result_output_file is not None: + cur_test_result_output_file.close() + test_output_file = work_dir / f"{len(test_results)}.txt" + cur_test_result = TestResult(test_name=test_name, output_file=test_output_file, passed=True) + test_results.append(cur_test_result) + cur_test_result_output_file = test_output_file.open("wt", encoding="utf8", errors="replace") + + if cur_test_result_output_file is not None: + cur_test_result_output_file.write(line) + + test_failed_match = TEST_FAILED_TOKEN in line and re.search(TEST_FAILED_PATTERN, line) + if test_failed_match: + test_name = test_failed_match.group("name") + logging.warning("FAILED TEST: %s", test_name) + if cur_test_result is None: + logging.warning( + "WARNING: failed test reported without matching test started: %s", test_name + ) + else: + cur_test_result.passed = False + + test_finished_match = TEST_FINISHED_TOKEN in line and re.search(TEST_FINISHED_PATTERN, line) + if test_finished_match: + test_name = test_finished_match.group("name") + logging.debug('Found "Test Finished" logcat line for test: %s', test_name) + if cur_test_result_output_file is not None: + cur_test_result_output_file.close() + cur_test_result_output_file = None + cur_test_result = None + + if cur_test_result_output_file is not None: + cur_test_result_output_file.close() + del cur_test_result_output_file + + passed_tests = [test_result for test_result in test_results if test_result.passed] + failed_tests = [test_result for test_result in test_results if not test_result.passed] + print_line( + f"Found results for {len(test_results)} tests: " + f"{len(passed_tests)} passed, {len(failed_tests)} failed" + ) + + if len(failed_tests) > 0: + fail_number = 0 + for failed_test_result in failed_tests: + fail_number += 1 + print_line("") + print_line(f"Failure {fail_number}/{len(failed_tests)}: {failed_test_result.test_name}:") + try: + with failed_test_result.output_file.open( + "rt", encoding="utf8", errors="ignore" + ) as test_output_file: + for line in test_output_file: + print_line(line.rstrip()) + except OSError: + logging.warning("WARNING: reading file failed: %s", failed_test_result.output_file) + continue + + if work_temp_dir is not None: + logging.debug("Cleaning up temporary directory: %s", work_dir) + del work_dir + del work_temp_dir + + +def print_line(line: str) -> None: + print(line) # noqa: T201 + + +class ParsedArgs(typing.Protocol): + logcat_file: pathlib.Path + log_level: int + work_dir: pathlib.Path | None + + +def parse_args() -> ParsedArgs: + arg_parser = argparse.ArgumentParser() + arg_parser.add_argument( + "--logcat-file", + required=True, + help="The text file containing the logcat logs to scan.", + ) + arg_parser.add_argument( + "--work-dir", + default=None, + help="The directory into which to write temporary files; " + "if not specified, use a temporary directory that is deleted " + "when this script completes; this is primarily intended for " + "developers of this script to use in testing and debugging", + ) + arg_parser.add_argument( + "--verbose", + action="store_const", + dest="log_level", + default=logging.INFO, + const=logging.DEBUG, + help="Include debug logging output", + ) + + parse_result = arg_parser.parse_args() + + parse_result.logcat_file = pathlib.Path(parse_result.logcat_file) + parse_result.work_dir = ( + None if parse_result.work_dir is None else pathlib.Path(parse_result.work_dir) + ) + return typing.cast("ParsedArgs", parse_result) + + +if __name__ == "__main__": + main() diff --git a/firebase-dataconnect/ci/logcat_error_report_test.py b/firebase-dataconnect/ci/logcat_error_report_test.py new file mode 100644 index 00000000000..59030ec7c4e --- /dev/null +++ b/firebase-dataconnect/ci/logcat_error_report_test.py @@ -0,0 +1,149 @@ +# 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. + +from __future__ import annotations + +import re + +import pytest + +import logcat_error_report as sut + + +class TestRegularExpressionPatterns: + @pytest.mark.parametrize( + "string", + [ + "", + "XTestRunner: started: fooTest1234", + "TestRunner: started:fooTest1234", + pytest.param( + "TestRunner: started: fooTest1234", + marks=pytest.mark.xfail( + reason="make sure that the test would otherwise pass on match", + strict=True, + ), + ), + ], + ) + def test_test_started_pattern_no_match(self, string: str) -> None: + assert re.search(sut.TEST_STARTED_PATTERN, string) is None + + @pytest.mark.parametrize( + ("string", "expected_name"), + [ + ("TestRunner: started: fooTest1234", "fooTest1234"), + (" TestRunner: started: fooTest1234", "fooTest1234"), + ("TestRunner: started: fooTest1234", "fooTest1234"), + ("TestRunner: started: fooTest1234 ", "fooTest1234"), + ("TestRunner: started: fooTest1234(abc.123)", "fooTest1234(abc.123)"), + ("TestRunner: started: a $ 2 ^ %% . ", "a $ 2 ^ %% ."), + pytest.param( + "i do not match the pattern", + None, + marks=pytest.mark.xfail( + reason="make sure that the test would otherwise pass on match", + strict=True, + ), + ), + ], + ) + def test_test_started_pattern_match(self, string: str, expected_name: str) -> None: + match = re.search(sut.TEST_STARTED_PATTERN, string) + assert match is not None + assert match.group("name") == expected_name + + @pytest.mark.parametrize( + "string", + [ + "", + "XTestRunner: finished: fooTest1234", + "TestRunner: finished:fooTest1234", + pytest.param( + "TestRunner: finished: fooTest1234", + marks=pytest.mark.xfail( + reason="make sure that the test would otherwise pass on match", + strict=True, + ), + ), + ], + ) + def test_test_finished_pattern_no_match(self, string: str) -> None: + assert re.search(sut.TEST_FINISHED_PATTERN, string) is None + + @pytest.mark.parametrize( + ("string", "expected_name"), + [ + ("TestRunner: finished: fooTest1234", "fooTest1234"), + (" TestRunner: finished: fooTest1234", "fooTest1234"), + ("TestRunner: finished: fooTest1234", "fooTest1234"), + ("TestRunner: finished: fooTest1234 ", "fooTest1234"), + ("TestRunner: finished: fooTest1234(abc.123)", "fooTest1234(abc.123)"), + ("TestRunner: finished: a $ 2 ^ %% . ", "a $ 2 ^ %% ."), + pytest.param( + "i do not match the pattern", + None, + marks=pytest.mark.xfail( + reason="make sure that the test would otherwise pass on match", + strict=True, + ), + ), + ], + ) + def test_test_finished_pattern_match(self, string: str, expected_name: str) -> None: + match = re.search(sut.TEST_FINISHED_PATTERN, string) + assert match is not None + assert match.group("name") == expected_name + + @pytest.mark.parametrize( + "string", + [ + "", + "XTestRunner: failed: fooTest1234", + "TestRunner: failed:fooTest1234", + pytest.param( + "TestRunner: failed: fooTest1234", + marks=pytest.mark.xfail( + reason="make sure that the test would otherwise pass on match", + strict=True, + ), + ), + ], + ) + def test_test_failed_pattern_no_match(self, string: str) -> None: + assert re.search(sut.TEST_FAILED_PATTERN, string) is None + + @pytest.mark.parametrize( + ("string", "expected_name"), + [ + ("TestRunner: failed: fooTest1234", "fooTest1234"), + (" TestRunner: failed: fooTest1234", "fooTest1234"), + ("TestRunner: failed: fooTest1234", "fooTest1234"), + ("TestRunner: failed: fooTest1234 ", "fooTest1234"), + ("TestRunner: failed: fooTest1234(abc.123)", "fooTest1234(abc.123)"), + ("TestRunner: failed: a $ 2 ^ %% . ", "a $ 2 ^ %% ."), + pytest.param( + "i do not match the pattern", + None, + marks=pytest.mark.xfail( + reason="make sure that the test would otherwise pass on match", + strict=True, + ), + ), + ], + ) + def test_test_failed_pattern_match(self, string: str, expected_name: str) -> None: + match = re.search(sut.TEST_FAILED_PATTERN, string) + assert match is not None + assert match.group("name") == expected_name diff --git a/firebase-dataconnect/ci/pyproject.toml b/firebase-dataconnect/ci/pyproject.toml index 3afddaa1c6c..71800e3a086 100644 --- a/firebase-dataconnect/ci/pyproject.toml +++ b/firebase-dataconnect/ci/pyproject.toml @@ -16,6 +16,7 @@ indent-width = 2 [tool.ruff.lint] select = ["ALL"] ignore = [ + "C901", # function is too complex "COM812", # missing-trailing-comma "D100", # Missing docstring in public module "D101", # Missing docstring in public class @@ -29,6 +30,8 @@ ignore = [ "E501", # Line too long (will be fixed by the formatter) "EM101", # Exception must not use a string literal, assign to variable first "LOG015", # root-logger-call + "PLR0912", # Too many branches + "PLR0915", # Too many statements "TRY003", # Avoid specifying long messages outside the exception class ] diff --git a/firebase-dataconnect/gradle.properties b/firebase-dataconnect/gradle.properties index 844d1ae93b2..c763f64467b 100644 --- a/firebase-dataconnect/gradle.properties +++ b/firebase-dataconnect/gradle.properties @@ -1,2 +1,2 @@ -version=16.0.1 -latestReleasedVersion=16.0.0 +version=16.0.2 +latestReleasedVersion=16.0.1 diff --git a/firebase-firestore/CHANGELOG.md b/firebase-firestore/CHANGELOG.md index e54bd037d93..29416bcf9a4 100644 --- a/firebase-firestore/CHANGELOG.md +++ b/firebase-firestore/CHANGELOG.md @@ -1,7 +1,16 @@ # Unreleased + + +# 25.1.4 * [fixed] Fixed the `null` value handling in `whereNotEqualTo` and `whereNotIn` filters. * [fixed] Catch exception when stream is already cancelled during close. [#6894](//github.com/firebase/firebase-android-sdk/pull/6894) + +## Kotlin +The Kotlin extensions library transitively includes the updated +`firebase-firestore` library. The Kotlin extensions library has no additional +updates. + # 25.1.3 * [fixed] Use lazy encoding in UTF-8 encoded byte comparison for strings to solve performance issues. [#6706](//github.com/firebase/firebase-android-sdk/pull/6706) * [changed] Updated `protolite-well-known-types` dependency to `18.0.1`. [#6716] diff --git a/firebase-firestore/gradle.properties b/firebase-firestore/gradle.properties index fef34db2530..e95453bed4d 100644 --- a/firebase-firestore/gradle.properties +++ b/firebase-firestore/gradle.properties @@ -1,2 +1,2 @@ -version=25.1.4 -latestReleasedVersion=25.1.3 +version=25.1.5 +latestReleasedVersion=25.1.4 diff --git a/firebase-sessions/CHANGELOG.md b/firebase-sessions/CHANGELOG.md index 8353fbf9029..70ad76eb6fe 100644 --- a/firebase-sessions/CHANGELOG.md +++ b/firebase-sessions/CHANGELOG.md @@ -1,6 +1,15 @@ # Unreleased +# 2.1.1 +* [unchanged] Updated to keep SDK versions aligned. + + +## Kotlin +The Kotlin extensions library transitively includes the updated +`firebase-sessions` library. The Kotlin extensions library has no additional +updates. + # 2.1.0 * [changed] Add warning for known issue b/328687152 * [changed] Use Dagger for dependency injection diff --git a/firebase-sessions/gradle.properties b/firebase-sessions/gradle.properties index b81f9766b9f..0a3e66d5a26 100644 --- a/firebase-sessions/gradle.properties +++ b/firebase-sessions/gradle.properties @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -version=2.1.1 -latestReleasedVersion=2.1.0 +version=2.1.2 +latestReleasedVersion=2.1.1 diff --git a/firebase-storage/CHANGELOG.md b/firebase-storage/CHANGELOG.md index d44617bce67..7594329d4a1 100644 --- a/firebase-storage/CHANGELOG.md +++ b/firebase-storage/CHANGELOG.md @@ -1,4 +1,5 @@ # Unreleased +* [fixed] Fixed an issue where tests were depending on a deprecated feature of the test framework (#6927) # 21.0.1 * [fixed] Fixed an issue where `maxUploadRetryTimeMillis` parameter is ignored when uploading using diff --git a/firebase-storage/src/test/java/com/google/firebase/storage/DownloadTest.java b/firebase-storage/src/test/java/com/google/firebase/storage/DownloadTest.java index 8f47147ef90..f47566058a7 100644 --- a/firebase-storage/src/test/java/com/google/firebase/storage/DownloadTest.java +++ b/firebase-storage/src/test/java/com/google/firebase/storage/DownloadTest.java @@ -18,9 +18,11 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.robolectric.Shadows.shadowOf; import android.net.Uri; import android.os.Build; +import android.os.Looper; import com.google.android.gms.tasks.Task; import com.google.firebase.FirebaseApp; import com.google.firebase.storage.TestDownloadHelper.StreamDownloadResponse; @@ -40,14 +42,13 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; -import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; /** Tests for {@link FirebaseStorage}. */ @SuppressWarnings("ConstantConditions") @RunWith(RobolectricTestRunner.class) -@Config(sdk = Build.VERSION_CODES.LOLLIPOP_MR1) +@Config(sdk = Build.VERSION_CODES.M) public class DownloadTest { @Rule public RetryRule retryRule = new RetryRule(3); @@ -137,7 +138,7 @@ public void streamDownloadStateVerification() throws Exception { ControllableSchedulerHelper.getInstance().resume(); for (int i = 0; i < 3000; i++) { - Robolectric.flushForegroundThreadScheduler(); + shadowOf(Looper.getMainLooper()).runToEndOfTasks(); if (semaphore.tryAcquire(2, 1, TimeUnit.MILLISECONDS)) { Assert.assertEquals(bytesDownloaded.get(), bytesTransferred.get()); return; @@ -256,7 +257,7 @@ public void byteDownload() throws Exception { TestDownloadHelper.byteDownload( new StringBuilder(), bitmap -> assertEquals(1076408, bitmap.length)); for (int i = 0; i < 3000; i++) { - Robolectric.flushForegroundThreadScheduler(); + shadowOf(Looper.getMainLooper()).runToEndOfTasks(); if (semaphore.tryAcquire(1, 1, TimeUnit.MILLISECONDS)) { // success! factory.verifyOldMock(); diff --git a/firebase-storage/src/test/java/com/google/firebase/storage/TestUtil.java b/firebase-storage/src/test/java/com/google/firebase/storage/TestUtil.java index 1b70a9d26c6..d2bc5a0ba87 100644 --- a/firebase-storage/src/test/java/com/google/firebase/storage/TestUtil.java +++ b/firebase-storage/src/test/java/com/google/firebase/storage/TestUtil.java @@ -14,6 +14,9 @@ package com.google.firebase.storage; +import static org.robolectric.Shadows.shadowOf; + +import android.os.Looper; import androidx.annotation.Nullable; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.tasks.Task; @@ -26,7 +29,6 @@ import java.io.StringReader; import java.util.concurrent.TimeUnit; import org.junit.Assert; -import org.robolectric.Robolectric; /** Test helpers. */ public class TestUtil { @@ -138,7 +140,7 @@ static void await(Task task, int timeout, TimeUnit timeUnit) throws Interrupt long timeoutMillis = timeUnit.toMillis(timeout); for (int i = 0; i < timeoutMillis; i++) { - Robolectric.flushForegroundThreadScheduler(); + shadowOf(Looper.getMainLooper()).runToEndOfTasks(); if (task.isComplete()) { // success! return; diff --git a/firebase-vertexai/CHANGELOG.md b/firebase-vertexai/CHANGELOG.md index d4aab80d601..3f38d8620e2 100644 --- a/firebase-vertexai/CHANGELOG.md +++ b/firebase-vertexai/CHANGELOG.md @@ -1,4 +1,20 @@ # 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 * [changed] **Breaking Change**: `LiveModelFutures.connect` now returns `ListenableFuture` instead of `ListenableFuture`. * **Action Required:** Remove any transformations from LiveSession object to LiveSessionFutures object. * **Action Required:** Change type of variable handling `LiveModelFutures.connect` to `ListenableFuture` @@ -17,7 +33,6 @@ * [changed] Removed the `LiveContentResponse.Status` class, and instead have nested the status fields as properties of `LiveContentResponse`. (#6906) - # 16.3.0 * [feature] Emits a warning when attempting to use an incompatible model with `GenerativeModel` or `ImagenModel`. 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/gradle.properties b/firebase-vertexai/gradle.properties index 6b68ce2a134..9e844d89335 100644 --- a/firebase-vertexai/gradle.properties +++ b/firebase-vertexai/gradle.properties @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -version=16.4.0 -latestReleasedVersion=16.3.0 +version=16.4.1 +latestReleasedVersion=16.4.0 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 066e672ffb8..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 @@ -21,8 +21,11 @@ import com.google.firebase.concurrent.FirebaseExecutors; import com.google.firebase.vertexai.FirebaseVertexAI; import com.google.firebase.vertexai.GenerativeModel; +import com.google.firebase.vertexai.LiveGenerativeModel; import com.google.firebase.vertexai.java.ChatFutures; import com.google.firebase.vertexai.java.GenerativeModelFutures; +import com.google.firebase.vertexai.java.LiveModelFutures; +import com.google.firebase.vertexai.java.LiveSessionFutures; import com.google.firebase.vertexai.type.BlockReason; import com.google.firebase.vertexai.type.Candidate; import com.google.firebase.vertexai.type.Citation; @@ -33,24 +36,37 @@ import com.google.firebase.vertexai.type.FileDataPart; import com.google.firebase.vertexai.type.FinishReason; import com.google.firebase.vertexai.type.FunctionCallPart; +import com.google.firebase.vertexai.type.FunctionResponsePart; import com.google.firebase.vertexai.type.GenerateContentResponse; +import com.google.firebase.vertexai.type.GenerationConfig; import com.google.firebase.vertexai.type.HarmCategory; import com.google.firebase.vertexai.type.HarmProbability; 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.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; import com.google.firebase.vertexai.type.PromptFeedback; +import com.google.firebase.vertexai.type.ResponseModality; import com.google.firebase.vertexai.type.SafetyRating; +import com.google.firebase.vertexai.type.SpeechConfig; import com.google.firebase.vertexai.type.TextPart; import com.google.firebase.vertexai.type.UsageMetadata; +import com.google.firebase.vertexai.type.Voices; import java.util.Calendar; import java.util.List; import java.util.Map; import java.util.concurrent.Executor; import kotlinx.serialization.json.JsonElement; import kotlinx.serialization.json.JsonNull; +import kotlinx.serialization.json.JsonObject; import org.junit.Assert; import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; @@ -63,9 +79,31 @@ public class JavaCompileTests { public void initializeJava() throws Exception { FirebaseVertexAI vertex = FirebaseVertexAI.getInstance(); - GenerativeModel model = vertex.generativeModel("fake-model-name"); + GenerativeModel model = vertex.generativeModel("fake-model-name", getConfig()); + LiveGenerativeModel live = vertex.liveModel("fake-model-name", getLiveConfig()); GenerativeModelFutures futures = GenerativeModelFutures.from(model); + LiveModelFutures liveFutures = LiveModelFutures.from(live); testFutures(futures); + testLiveFutures(liveFutures); + } + + private GenerationConfig getConfig() { + return new GenerationConfig.Builder().build(); + // TODO b/406558430 GenerationConfig.Builder.setParts returns void + } + + private LiveGenerationConfig getLiveConfig() { + return new LiveGenerationConfig.Builder() + .setTopK(10) + .setTopP(11.0F) + .setTemperature(32.0F) + .setCandidateCount(1) + .setMaxOutputTokens(0xCAFEBABE) + .setFrequencyPenalty(1.0F) + .setPresencePenalty(2.0F) + .setResponseModality(ResponseModality.AUDIO) + .setSpeechConfig(new SpeechConfig(Voices.AOEDE)) + .build(); } private void testFutures(GenerativeModelFutures futures) throws Exception { @@ -236,4 +274,67 @@ public void validateUsageMetadata(UsageMetadata metadata) { } } } + + private void testLiveFutures(LiveModelFutures futures) throws Exception { + LiveSessionFutures session = futures.connect().get(); + session + .receive() + .subscribe( + new Subscriber() { + @Override + public void onSubscribe(Subscription s) { + s.request(Long.MAX_VALUE); + } + + @Override + public void onNext(LiveServerMessage response) { + validateLiveContentResponse(response); + } + + @Override + public void onError(Throwable t) { + // Ignore + } + + @Override + public void onComplete() { + // Also ignore + } + }); + + session.send("Fake message"); + session.send(new Content.Builder().addText("Fake message").build()); + + byte[] bytes = new byte[] {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE}; + session.sendMediaStream(List.of(new MediaData(bytes, "image/jxl"))); + + FunctionResponsePart functionResponse = + new FunctionResponsePart("myFunction", new JsonObject(Map.of())); + session.sendFunctionResponse(List.of(functionResponse, functionResponse)); + + session.startAudioConversation(part -> functionResponse); + session.startAudioConversation(); + session.stopAudioConversation(); + session.stopReceiving(); + session.close(); + } + + 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(); + } + } } 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" diff --git a/release.json b/release.json new file mode 100644 index 00000000000..4a7e870b024 --- /dev/null +++ b/release.json @@ -0,0 +1,18 @@ +{ + "name": "m163", + "libraries": [ + ":firebase-ai", + ":firebase-config", + ":firebase-config:ktx", + ":firebase-crashlytics", + ":firebase-crashlytics-ndk", + ":firebase-sessions", + ":firebase-crashlytics:ktx", + ":firebase-dataconnect", + ":firebase-firestore", + ":firebase-firestore:ktx", + ":firebase-storage", + ":firebase-storage:ktx", + ":firebase-vertexai" + ] +} \ No newline at end of file diff --git a/release_report.json b/release_report.json new file mode 100644 index 00000000000..63654e3ce6a --- /dev/null +++ b/release_report.json @@ -0,0 +1,445 @@ +{ + "changesByLibraryName": { + "firebase-ai": [ + { + "commitId": "4c29e0b467d2bf1318714c75ff011b22995eea16", + "prId": "6939", + "author": "Vinay Guthal", + "message": "Add headers to be able to track bidi usage (#6939)\n\nOriginally we were not tracking bidi usage in android. This PR enables\nit by adding certain headers when the initial websocket connection is\nmade. There was some refractoring done wrt to extract out the part which\njust adds the headers from the applyCommonConfiguration function", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/4c29e0b467d2bf1318714c75ff011b22995eea16", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6939" + }, + { + "commitId": "bbe3de1925e4f964854a0f30ef7392d64d4c70f9", + "prId": "6932", + "author": "Rodrigo Lazo", + "message": "[Ai] Fix test code to point to the right resource dir (#6932)\n\nThe devAPI helper method should read from the `googleai/` directory\ninstead of the `vertexai/` one.\n\nAdditionally, fixed tests broken by the change.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/bbe3de1925e4f964854a0f30ef7392d64d4c70f9", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6932" + }, + { + "commitId": "24dd7c48441b684bd2e99f260a5d0d5eb9ba1ef2", + "prId": "6930", + "author": "emilypgoogle", + "message": "Fix AI builders for Java consumers (#6930)\n\nFixes all Firebase AI builder patterns to be properly usable by Java\nconsumers. Small breaking binary change, no breaking source change.\nAdditionally, now that the builder pattern can be used, compile tests\nfor the builders and other classes like `Schema` have been implemented.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/24dd7c48441b684bd2e99f260a5d0d5eb9ba1ef2", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6930" + }, + { + "commitId": "0a880cc7a35a5cdcd012eaf70c2b00f7c4503569", + "prId": "6925", + "author": "Rodrigo Lazo", + "message": "[Ai] Add workaround for invalid SafetyRating from the backend. (#6925)\n\nDue to a bug in the backend, it's possible that we receive an invalid\n`SafetyRating` value, without either category or probability. We return\nnull in those cases to enable filtering by the higher level types.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/0a880cc7a35a5cdcd012eaf70c2b00f7c4503569", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6925" + }, + { + "commitId": "4b12b337c1291de22fe35322c9575bdadbc74129", + "prId": "6903", + "author": "emilypgoogle", + "message": "Add Java VertexAI bidi compile tests (#6903)\n\nAdded Java compile tests for VertexAI's bidi support. Notably\nb/412743328 was filed due to `LiveContentResponse.Status` being\ninaccessible properly for Java.\n\nIn addition, minor non-bidi testing for `GenerationContent` being\ninaccessible was added, relating to a previous bug.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/4b12b337c1291de22fe35322c9575bdadbc74129", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6903" + }, + { + "commitId": "2b2388713889db915ab76d94f672350952e4be8d", + "prId": "6910", + "author": "Daymon", + "message": "Align LiveSeverMessage related protos (#6910)\n\nPer [b/410856389](https://b.corp.google.com/issues/410856389),\n\nThis removes the `LiveContentResponse` and provides a\n`LiveServerMessage` in its place that aligns with the proto, and the\nother SDKs. Documentation is included for everything added.\n\nAdditionally, this PR fixes the following:\n\n- [b/410040441](https://b.corp.google.com/issues/410040441) -> Add\nsupport for id field on functions\n- [b/413437559](https://b.corp.google.com/issues/413437559) -> Add\nsupport for generationComplete\n- [b/414602833](https://b.corp.google.com/issues/414602833) -> Fix\nfirebase ai changelog", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/2b2388713889db915ab76d94f672350952e4be8d", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6910" + }, + { + "commitId": "7b7e11ea5eafbcda1fcaa8ab1752b7cfaf11e425", + "prId": "6917", + "author": "Daymon", + "message": "Fix AI test timeout (#6917)\n\nPer [b/414406390](https://b.corp.google.com/issues/414406390),\n\nThis fixes the issue with long text golden files timing out the tests.\nThis occurred because the text contents were too large for the channel's\nbuffer- so the channel entered a suspension point until the content was\nread. Unfortunately, this suspension point blocked the test thread. To\nsolve this, we do the same thing we do for `goldenStreamingFile`- we\nwrite to the channel in a separate coroutine scope. This allows Kotlin\nto properly recognize that the suspension point within the writer should\nallow for the test thread to continue.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/7b7e11ea5eafbcda1fcaa8ab1752b7cfaf11e425", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6917" + }, + { + "commitId": "cbd963688b1e121cde93b6c02384d1b8dbdf4465", + "prId": "6921", + "author": "Daymon", + "message": "Add ResponseModality support to GenerationConfig (#6921)\n\nPer [b/414638874](https://b.corp.google.com/issues/414638874),\n\nThis adds support for `ResponseModality` in `GenerationConfig`. #6901\nadded this, but it seems it was missed during the migration to\n`firebase-ai`.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/cbd963688b1e121cde93b6c02384d1b8dbdf4465", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6921" + }, + { + "commitId": "a87935401e6cf0dececaaae977bfa44bda49b430", + "prId": "6922", + "author": "Daymon", + "message": "Add inlineDataParts helper property (#6922)\n\nPer [b/414639898](https://b.corp.google.com/issues/414639898),\n\nThis adds a helper property to `GenerateContentResponse` for getting all\nthe `InlineDataPart` present in the first candidate, similar to `text`.\n\nThis was actually added in #6901, but it seems to have been missed\nduring our `firebase-ai` migration.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/a87935401e6cf0dececaaae977bfa44bda49b430", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6922" + }, + { + "commitId": "79248138c9320c127d34fb7197f24981441f3960", + "prId": "6916", + "author": "Rodrigo Lazo", + "message": "[ai] Use .json for unary tests instead of .txt (#6916)\n\nFollow up to #6915\n\n---------\n\nCo-authored-by: David Motsonashvili \nCo-authored-by: David Motsonashvili \nCo-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/79248138c9320c127d34fb7197f24981441f3960", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6916" + }, + { + "commitId": "7cbb80b9762cee4b3f1c934b83251fb8c9a189f5", + "prId": "6911", + "author": "David Motsonashvili", + "message": "Davidmotson.firebase ai (#6911)\n\nCo-authored-by: David Motsonashvili ", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/7cbb80b9762cee4b3f1c934b83251fb8c9a189f5", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6911" + } + ], + "firebase-config": [ + { + "commitId": "548dc2886be128260a2366cb5363d555124b7875", + "prId": "6940", + "author": "Tushar Khandelwal", + "message": "Fix NetworkOnMainThreadException for API levels below 26 (#6940)\n\nThis change addresses a ``NetworkOnMainThreadException`` that was\nobserved on Android API levels below 26.\nThe crash happened during background transitions when disconnecting an\n``HttpURLConnection`` because background callbacks on these older OS\nversions could run on the main thread. The fix restricts the disconnect\nlogic to run only on API level 26 (Android 8.0) and higher.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/548dc2886be128260a2366cb5363d555124b7875", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6940" + }, + { + "commitId": "5aff679ee3e0fa22c1ff7876f08eb9088acd41c3", + "prId": "6875", + "author": "Rodrigo Lazo", + "message": "[RC] Remove package declaration from testapp manifest (#6875)\n\nThis is a leftover from a previous migration that moved the\nnamespace/package declarations from the `AndroidManifest.xml` files to\nthe gradle build files.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/5aff679ee3e0fa22c1ff7876f08eb9088acd41c3", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6875" + }, + { + "commitId": "5081e7c978c4f9ff7d358f4b8713ef15a57c1058", + "prId": "6816", + "author": "Tushar Khandelwal", + "message": "Disconnect from Remote Config real-time server when app is backgrounded. (#6816)\n\nThis PR focuses on enhancing the reliability and efficiency of the\nRemote Config real-time stream, particularly concerning background app\nstates. We've refined the ``ConfigRealtimeHttpClient`` to retrieve and\nmanage the underlying input and error streams more effectively, ensuring\nproper closure even in error scenarios. Additionally, the\n``closeRealtimeHttpStream`` method now explicitly closes these streams\nusing the acquired references.\n\nA key improvement is the robust handling of the app's background state.\nThe ``setRealtimeBackgroundState`` method is now synchronized to\nguarantee thread-safe updates and will immediately close the real-time\nHTTP connection when the app transitions to the background. This\nbackground state is also reflected in ``ConfigAutoFetch``, allowing for\nconditional exception logging during real-time stream listening,\nensuring logs are only generated when the app is actively in the\nforeground. Furthermore, ``ConfigAutoFetch`` now maintains a dedicated\n``InputStream`` reference to ensure proper stream closure, and a\nseparate reference is kept in ``beginRealtimeHttpStream`` to handle\npotential early closure scenarios before ``ConfigAutoFetch`` is reached.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/5081e7c978c4f9ff7d358f4b8713ef15a57c1058", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6816" + } + ], + "firebase-config/ktx": [ + ], + "firebase-crashlytics": [ + { + "commitId": "f5ec0a6e1828c395946538c2baf71f55ea86cc8f", + "prId": "6937", + "author": "themiswang", + "message": "fix more strict mode violation (#6937)\n\n#no-changelog", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/f5ec0a6e1828c395946538c2baf71f55ea86cc8f", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6937" + }, + { + "commitId": "19c8c7f822c130698cf2db8e9ee3b9f11fa91b9e", + "prId": "6822", + "author": "Angel Leon", + "message": "fix: avoid android.os.strictmode.UnbufferedIoViolation (resubmission of PR #6565) (#6822)\n\n- Wrap InputStream with BufferedInputStream to ensure buffered I/O and\nprevent UnbufferedIoViolation in Android 14 (SDK 34).\n- Use try-with-resources to automatically close streams, improving\nresource management.\n- Retain existing functionality for converting InputStream to a UTF-8\nstring.\n\nThis change ensures compliance with Android 14's stricter I/O policies.\n\nCo-authored-by: Matthew Robertson \nCo-authored-by: David Motsonashvili ", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/19c8c7f822c130698cf2db8e9ee3b9f11fa91b9e", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6822" + } + ], + "firebase-crashlytics-ndk": [ + { + "commitId": "cf2b7a86ff988ce9d37d7390520547f54a36381c", + "prId": "6814", + "author": "Matthew Robertson", + "message": "Upgrade to Android ndk r27c and update Crashpad to latest commit (#6814)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/cf2b7a86ff988ce9d37d7390520547f54a36381c", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6814" + }, + { + "commitId": "5ff9d9576741c6a8fbcdf0507d53da8b08a4f146", + "prId": "6797", + "author": "Matthew Robertson", + "message": "Updated internal Crashpad version (#6797)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/5ff9d9576741c6a8fbcdf0507d53da8b08a4f146", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6797" + } + ], + "firebase-sessions": [ + { + "commitId": "278e437a7dd02c9046186eda707a020e63e214d4", + "prId": "6809", + "author": "Tejas Deshpande", + "message": "Changes in the Session Test App to verify behaviour with Fireperf #no-changelog (#6809)\n\nThis change adds a way to repeatedly log identical performance traces in\ndifferent processes.\n- Currently traces on different activities are logged on different\nFireperf Sessions.\n- Adds additional logging to help identify different Firebase instances\nin different processes.\n- Adds Fireperf custom attributes to identify processes.\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/278e437a7dd02c9046186eda707a020e63e214d4", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6809" + } + ], + "firebase-crashlytics/ktx": [ + ], + "firebase-dataconnect": [ + { + "commitId": "88f50d5744a90a165c00329991d630a1a7071cd1", + "prId": "6902", + "author": "Denver Coneybeare", + "message": "dataconnect: include relevant logcat snippets in github actions logs when androidTest tests fail (#6902)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/88f50d5744a90a165c00329991d630a1a7071cd1", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6902" + }, + { + "commitId": "534cc539ff919ad6078021832007cbec0ec1258b", + "prId": "6861", + "author": "Denver Coneybeare", + "message": "FirebaseDataConnectImpl.kt: use MutableStateFlow to store state, rather than mutexes (#6861)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/534cc539ff919ad6078021832007cbec0ec1258b", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6861" + }, + { + "commitId": "fd6553969b374f325d1340698504ecbf3f58ecfa", + "prId": "6896", + "author": "Denver Coneybeare", + "message": "dataconnect: use firebase-tools to launch fdc emulator instead of launching it directly (#6896)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/fd6553969b374f325d1340698504ecbf3f58ecfa", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6896" + }, + { + "commitId": "bd2cb5f1d6cef61fd88845e5ca29b229188d3ad5", + "prId": "6880", + "author": "Denver Coneybeare", + "message": "dataconnect: create python script to post comments about scheduled runs (#6880)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/bd2cb5f1d6cef61fd88845e5ca29b229188d3ad5", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6880" + }, + { + "commitId": "51b4a1c3c03608ad40555113e1189b64dd12505c", + "prId": "6840", + "author": "Denver Coneybeare", + "message": "dataconnect: Improve usage of MutableStateFlow to improve readability (#6840)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/51b4a1c3c03608ad40555113e1189b64dd12505c", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6840" + }, + { + "commitId": "210dc0279ee974fac677f2aa7cc50d26586aea7d", + "prId": "6854", + "author": "Denver Coneybeare", + "message": "dataconnect: AuthIntegrationTest.kt: add missing import for FirebaseDataConnectInternal (#6854)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/210dc0279ee974fac677f2aa7cc50d26586aea7d", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6854" + }, + { + "commitId": "dbf5d014ab08cf3d86b6e31d2650afad451fdb3c", + "prId": "6836", + "author": "Denver Coneybeare", + "message": "dataconnect: auth code internal cleanup (#6836)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/dbf5d014ab08cf3d86b6e31d2650afad451fdb3c", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6836" + }, + { + "commitId": "f826b40e84d1d58e895fc882a5131de9a9859042", + "prId": "6835", + "author": "Denver Coneybeare", + "message": "dataconnect: fix two flaky tests due to their failure to wait for FirebaseAuth to be initialized (#6835)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/f826b40e84d1d58e895fc882a5131de9a9859042", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6835" + }, + { + "commitId": "8af38c9599656d022b701b2304537a47a7bf6f35", + "prId": "6839", + "author": "Denver Coneybeare", + "message": "dataconnect: fix flaky test that ensures deserialize() throws IllegalArgumentException on invalid input (#6839)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/8af38c9599656d022b701b2304537a47a7bf6f35", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6839" + }, + { + "commitId": "75cdf963195c873151a6fe0ece181543c01cea5f", + "prId": "6827", + "author": "Denver Coneybeare", + "message": "dataconnect: QuerySubscriptionIntegrationTest.kt: fix flaky test using backgroundScope (#6827)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/75cdf963195c873151a6fe0ece181543c01cea5f", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6827" + }, + { + "commitId": "2cdac31dc2d9510c158596ebec4ce7ddba327eb5", + "prId": "6825", + "author": "Rodrigo Lazo", + "message": "Update changelog file (#6825)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/2cdac31dc2d9510c158596ebec4ce7ddba327eb5", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6825" + } + ], + "firebase-firestore": [ + { + "commitId": "fda3351722f16582024249bb7d336ca46f2d4068", + "prId": "6894", + "author": "Tom Andersen", + "message": "Handle error when stream was cancelled prior to calling halfClose. (#6894)\n\nThis should fix issue\nhttps://github.com/firebase/firebase-android-sdk/issues/6883", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/fda3351722f16582024249bb7d336ca46f2d4068", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6894" + }, + { + "commitId": "24fba9b55f2ba7c4a821bd2fa835cd1e0a97d8d4", + "prId": "6868", + "author": "Ehsan", + "message": "fix: Improve efficiency of online/offline composite index tests. (#6868)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/24fba9b55f2ba7c4a821bd2fa835cd1e0a97d8d4", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6868" + }, + { + "commitId": "edcea54ea570af828f31cf5f54e952ad6c32ff61", + "prId": "6859", + "author": "Mila", + "message": "fix: remove null value inclusion from `whereNotEqualTo` and `whereNotIn` filter results (#6859)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/edcea54ea570af828f31cf5f54e952ad6c32ff61", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6859" + }, + { + "commitId": "70c8e89dbc6698346a612d926da8f6bf1ddf6797", + "prId": "6841", + "author": "Ehsan", + "message": "Improve the integration test coverage for online vs offline comparisons. (#6841)\n\nThis PR improves the way `checkOnlineAndOfflineResultsMatch` test util\nfunction was written.\n\nIt does so by first pre-populating the cache with the entire collection,\nthen performing the query from cache (this results in a full collection\nscan), then performing the query from the server, and then performing\nthe query from cache again (this results in using\n`performQueryUsingRemoteKeys`. It then ensures that all of these 3\nresults are the same and equal to the expected results.\n\n#no-changelog", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/70c8e89dbc6698346a612d926da8f6bf1ddf6797", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6841" + } + ], + "firebase-firestore/ktx": [ + ], + "firebase-storage": [ + { + "commitId": "4c4c7c93b08bb0ba78b3e99cb00a50469c6eab24", + "prId": "6927", + "author": "Rodrigo Lazo", + "message": "[Storage] Migrate from Robolectric.flushForegroundThreadScheduler to ShadowLooper.runToEndOfTasks (#6927)\n\nThe Robolectric Scheduler APIs are designed for LEGACY Looper mode,\nwhere tasks were controlled by Scheduler objects. LEGACY Looper mode has\nbeen deprecated for 5+ years. Migrate from\nRobolectric.flushForegroundThreadScheduler to ShadowLooper APIs.\n\nSee cl/752917858 for reference\n\n---------\n\nCo-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/4c4c7c93b08bb0ba78b3e99cb00a50469c6eab24", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6927" + } + ], + "firebase-storage/ktx": [ + ], + "firebase-vertexai": [ + { + "commitId": "7b1855d1b60dfa886bd5e54b7793c008dee361b5", + "prId": "6941", + "author": "Daymon", + "message": "Prepare VertexAI SDK for release (#6941)\n\nPer [b/414829218](https://b.corp.google.com/issues/414829218),\n\nThis ensures the Vertex AI SDK is properly aligned for the upcoming\nrelease. More specifically, this PR does the following:\n\n- Adds deprecation notices for all the public classes and interfaces,\n**besides** the root `FirebaseVertexAI` class and the relevant extension\nmethods.\n- Updates the golden file version.\n- Adds the change from #6925 for working around invalid\n`SafetyRating`(s).\n- Adds a changelog entry that aligns with the deprecation notices.\n- Adds the changes from #6939 for tracking bidi usage.\n- Adds the changes from #6910 for aligning the bidi protos.\n\n---------\n\nCo-authored-by: Rodrigo Lazo ", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/7b1855d1b60dfa886bd5e54b7793c008dee361b5", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6941" + }, + { + "commitId": "4b12b337c1291de22fe35322c9575bdadbc74129", + "prId": "6903", + "author": "emilypgoogle", + "message": "Add Java VertexAI bidi compile tests (#6903)\n\nAdded Java compile tests for VertexAI's bidi support. Notably\nb/412743328 was filed due to `LiveContentResponse.Status` being\ninaccessible properly for Java.\n\nIn addition, minor non-bidi testing for `GenerationContent` being\ninaccessible was added, relating to a previous bug.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/4b12b337c1291de22fe35322c9575bdadbc74129", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6903" + }, + { + "commitId": "7b7e11ea5eafbcda1fcaa8ab1752b7cfaf11e425", + "prId": "6917", + "author": "Daymon", + "message": "Fix AI test timeout (#6917)\n\nPer [b/414406390](https://b.corp.google.com/issues/414406390),\n\nThis fixes the issue with long text golden files timing out the tests.\nThis occurred because the text contents were too large for the channel's\nbuffer- so the channel entered a suspension point until the content was\nread. Unfortunately, this suspension point blocked the test thread. To\nsolve this, we do the same thing we do for `goldenStreamingFile`- we\nwrite to the channel in a separate coroutine scope. This allows Kotlin\nto properly recognize that the suspension point within the writer should\nallow for the test thread to continue.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/7b7e11ea5eafbcda1fcaa8ab1752b7cfaf11e425", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6917" + }, + { + "commitId": "12127e6ec6a5e0e1264e248c5ba7fe7e7711595f", + "prId": "6912", + "author": "David Motsonashvili", + "message": "encodeBitmapToBase64Png -> encodeBitmapToBase64Jpeg (#6912)\n\nCo-authored-by: David Motsonashvili ", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/12127e6ec6a5e0e1264e248c5ba7fe7e7711595f", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6912" + }, + { + "commitId": "4fb4dfd197832035675b28320e09fb9105aa3639", + "prId": "6906", + "author": "Daymon", + "message": "Migrate LiveContentResponse.Status to properties (#6906)\n\nPer [b/410855548](https://b.corp.google.com/issues/410855548),\n\nThis removes the `LiveContentResponse.Status` class, and instead nests\nthe status as corresponding fields directly on `LiveContentResponse`.\nThis is done to ensure we can support the model returning multiple\nstatuses, since the model does not define them as exclusive.\n\nNote that proto alignment efforts will be in a separate PR. This PR is\n_only_ for migrating `Status` to properties.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/4fb4dfd197832035675b28320e09fb9105aa3639", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6906" + }, + { + "commitId": "d568e844fc79853a8a6c5b1a3819ef27d150f597", + "prId": "6905", + "author": "Rodrigo Lazo", + "message": "Refactor: Rename encodeBitmapToBase64Png to encodeBitmapToBase64Jpeg (#6905)\n\nThe private function `encodeBitmapToBase64Png` in\n`firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/type/Part.kt`\nwas already compressing Bitmap images to JPEG format, not PNG.\n\nThis commit renames the function to `encodeBitmapToBase64Jpeg` to\naccurately reflect its behavior. The single call site within the same\nfile has also been updated.\n\nno-changelog\n\nCo-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/d568e844fc79853a8a6c5b1a3819ef27d150f597", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6905" + }, + { + "commitId": "e9ef4799062b76b8a533c3ae0fe25d6d6b29a59d", + "prId": "6901", + "author": "Vinay Guthal", + "message": "Enable multimodal response generation in android (#6901)\n\nThis change enables use of multiple modalities when calling\ngenerateContent from the model.\nThis change adds a new field into the GenerationConfig to specify the\nresponseModalities which would be sent to the server. Also for easier\nresponse handling it exposes a function inlineDataParts which should\nreturn all the data sent back by the model.\n\n---------\n\nCo-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/e9ef4799062b76b8a533c3ae0fe25d6d6b29a59d", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6901" + }, + { + "commitId": "40b7637c6c4e246113b781ba5be3f1a7356678de", + "prId": "6870", + "author": "Daymon", + "message": "Refactor live bidi (#6870)\n\nPer [b/410070347](https://b.corp.google.com/issues/410070347),\n\nThis refactors our bidi model to be more thread safe, and take better\nadvantage of immutability and kotlin coroutines. This solves various\nedge case issues, as well as makes it easier to maintain.\n\nThis PR also fixes the following:\n- [b/410063693](https://b.corp.google.com/issues/410063693) -> Add\nserialization for bidi responses\n- [b/410064609](https://b.corp.google.com/issues/410064609) -> Retain\naudio data if present when turn complete or interrupted\n- [b/410069806](https://b.corp.google.com/issues/410069806) -> Use\nblocking instead of background dispatcher for bidi\n- [b/410841715](https://b.corp.google.com/issues/410841715) -> Catch\nBidi exceptions\n- [b/410067576](https://b.corp.google.com/issues/410067576) -> Send\nzeroed out audio data to server when not speaking", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/40b7637c6c4e246113b781ba5be3f1a7356678de", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6870" + }, + { + "commitId": "47e37b5802a1be2038bc392dadb9a88c4cec8dbe", + "prId": "6834", + "author": "Vinay Guthal", + "message": "Update LiveModelFutures to return LiveSessionFutures instead of LiveSession (#6834)\n\nUpdate the `connect` method of` LiveModelFutures` class to return\n`ListenableFuture` instead of `LiveSession`.\n\nThis change reduces the burden on Java developers, as they would have to\ncreate a `LiveSessionFutures` object anyway.\n\nAdditionally, the `startAudioConverstion` method is now annotated with\n`@JvmOverloads` to maintain compatibility with Java.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/47e37b5802a1be2038bc392dadb9a88c4cec8dbe", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6834" + }, + { + "commitId": "33e989f2f162348a2b75c19cbc8ce962e3d14264", + "prId": "6848", + "author": "Vinay Guthal", + "message": "update javadocs (#6848)\n\nCo-authored-by: Rodrigo Lazo \nCo-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/33e989f2f162348a2b75c19cbc8ce962e3d14264", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6848" + }, + { + "commitId": "d7a56a1e56699b8ea0ccd8bb752b702be2b39cf1", + "prId": "6837", + "author": "Vinay Guthal", + "message": "upate release notes (#6837)\n\nCo-authored-by: rachelsaunders <52258509+rachelsaunders@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/d7a56a1e56699b8ea0ccd8bb752b702be2b39cf1", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6837" + }, + { + "commitId": "9e89b289be79a8d7892db08be16d77e6a81eea45", + "prId": "6843", + "author": "Daymon", + "message": "Add support for HarmBlockThreshold.OFF (#6843)\n\nPer [b/409040155](https://b.corp.google.com/issues/409040155),\n\nThis adds support for `HarmBlockThreshold.OFF`, and also adds javadocs\nthat clearly articulate the difference it holds from `NONE`.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/9e89b289be79a8d7892db08be16d77e6a81eea45", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6843" + }, + { + "commitId": "6e3be7893e600014e855d8ca2b511c3681bbd7c2", + "prId": "6847", + "author": "Vinay Guthal", + "message": "use bytestream instead of bytearray (#6847)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/6e3be7893e600014e855d8ca2b511c3681bbd7c2", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6847" + }, + { + "commitId": "395e9dd51107bfb1057c220a847b6f420a250beb", + "prId": "6823", + "author": "Vinay Guthal", + "message": "fix emulator listening to itself (#6823)\n\n", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/395e9dd51107bfb1057c220a847b6f420a250beb", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6823" + }, + { + "commitId": "d2e72df5231cfe0a8067e139ce60aa108992972d", + "prId": "6759", + "author": "Vinay Guthal", + "message": "Bidirectional Streaming Android (#6759)\n\nBidirectional streaming for android. Creates a bunch of helper classes\nfor the same. The main classes which handle the bidirectional streaming\nare LiveGenerativeModel and LiveSession\n\n---------\n\nCo-authored-by: VinayGuthal \nCo-authored-by: Rodrigo Lazo Paz \nCo-authored-by: Rodrigo Lazo \nCo-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/d2e72df5231cfe0a8067e139ce60aa108992972d", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6759" + }, + { + "commitId": "dbeecd4df3803d14e885b011e5998129c87cfd87", + "prId": "6810", + "author": "emilypgoogle", + "message": "Add basic Vertex Java compilation tests (#6810)\n\nThis is a starting point for compilation testing, broadly using most\nsymbols Vertex exposes to Java users, lightly validating usability and\nstructure. As a note, there are some builder patterns in Vertex that\ndon't work as expected from Java and were omitted, as fixing that would\nbe a breaking change.", + "commitLink": "https://github.com/firebase/firebase-android-sdk/commit/dbeecd4df3803d14e885b011e5998129c87cfd87", + "prLink": "https://github.com/firebase/firebase-android-sdk/pull/6810" + } + ] + }, + "changedLibrariesWithNoChangelog": [ + ":firebase-functions", + ":firebase-functions:ktx", + ":firebase-perf", + ":firebase-perf:ktx", + ":protolite-well-known-types" + ] +} \ No newline at end of file diff --git a/release_report.md b/release_report.md new file mode 100644 index 00000000000..08d72d4eb42 --- /dev/null +++ b/release_report.md @@ -0,0 +1,191 @@ +# Release Report +## firebase-ai + +* Add headers to be able to track bidi usage (#6939) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6939) [commit](https://github.com/firebase/firebase-android-sdk/commit/4c29e0b467d2bf1318714c75ff011b22995eea16) [Vinay Guthal] + +* [Ai] Fix test code to point to the right resource dir (#6932) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6932) [commit](https://github.com/firebase/firebase-android-sdk/commit/bbe3de1925e4f964854a0f30ef7392d64d4c70f9) [Rodrigo Lazo] + +* Fix AI builders for Java consumers (#6930) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6930) [commit](https://github.com/firebase/firebase-android-sdk/commit/24dd7c48441b684bd2e99f260a5d0d5eb9ba1ef2) [emilypgoogle] + +* [Ai] Add workaround for invalid SafetyRating from the backend. (#6925) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6925) [commit](https://github.com/firebase/firebase-android-sdk/commit/0a880cc7a35a5cdcd012eaf70c2b00f7c4503569) [Rodrigo Lazo] + +* Add Java VertexAI bidi compile tests (#6903) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6903) [commit](https://github.com/firebase/firebase-android-sdk/commit/4b12b337c1291de22fe35322c9575bdadbc74129) [emilypgoogle] + +* Align LiveSeverMessage related protos (#6910) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6910) [commit](https://github.com/firebase/firebase-android-sdk/commit/2b2388713889db915ab76d94f672350952e4be8d) [Daymon] + +* Fix AI test timeout (#6917) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6917) [commit](https://github.com/firebase/firebase-android-sdk/commit/7b7e11ea5eafbcda1fcaa8ab1752b7cfaf11e425) [Daymon] + +* Add ResponseModality support to GenerationConfig (#6921) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6921) [commit](https://github.com/firebase/firebase-android-sdk/commit/cbd963688b1e121cde93b6c02384d1b8dbdf4465) [Daymon] + +* Add inlineDataParts helper property (#6922) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6922) [commit](https://github.com/firebase/firebase-android-sdk/commit/a87935401e6cf0dececaaae977bfa44bda49b430) [Daymon] + +* [ai] Use .json for unary tests instead of .txt (#6916) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6916) [commit](https://github.com/firebase/firebase-android-sdk/commit/79248138c9320c127d34fb7197f24981441f3960) [Rodrigo Lazo] + +* Davidmotson.firebase ai (#6911) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6911) [commit](https://github.com/firebase/firebase-android-sdk/commit/7cbb80b9762cee4b3f1c934b83251fb8c9a189f5) [David Motsonashvili] + +## firebase-config + +* Fix NetworkOnMainThreadException for API levels below 26 (#6940) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6940) [commit](https://github.com/firebase/firebase-android-sdk/commit/548dc2886be128260a2366cb5363d555124b7875) [Tushar Khandelwal] + +* [RC] Remove package declaration from testapp manifest (#6875) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6875) [commit](https://github.com/firebase/firebase-android-sdk/commit/5aff679ee3e0fa22c1ff7876f08eb9088acd41c3) [Rodrigo Lazo] + +* Disconnect from Remote Config real-time server when app is backgrounded. (#6816) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6816) [commit](https://github.com/firebase/firebase-android-sdk/commit/5081e7c978c4f9ff7d358f4b8713ef15a57c1058) [Tushar Khandelwal] + +## firebase-config/ktx + + +## firebase-crashlytics + +* fix more strict mode violation (#6937) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6937) [commit](https://github.com/firebase/firebase-android-sdk/commit/f5ec0a6e1828c395946538c2baf71f55ea86cc8f) [themiswang] + +* fix: avoid android.os.strictmode.UnbufferedIoViolation (resubmission of PR #6565) (#6822) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6822) [commit](https://github.com/firebase/firebase-android-sdk/commit/19c8c7f822c130698cf2db8e9ee3b9f11fa91b9e) [Angel Leon] + +## firebase-crashlytics-ndk + +* Upgrade to Android ndk r27c and update Crashpad to latest commit (#6814) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6814) [commit](https://github.com/firebase/firebase-android-sdk/commit/cf2b7a86ff988ce9d37d7390520547f54a36381c) [Matthew Robertson] + +* Updated internal Crashpad version (#6797) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6797) [commit](https://github.com/firebase/firebase-android-sdk/commit/5ff9d9576741c6a8fbcdf0507d53da8b08a4f146) [Matthew Robertson] + +## firebase-sessions + +* Changes in the Session Test App to verify behaviour with Fireperf #no-changelog (#6809) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6809) [commit](https://github.com/firebase/firebase-android-sdk/commit/278e437a7dd02c9046186eda707a020e63e214d4) [Tejas Deshpande] + +## firebase-crashlytics/ktx + + +## firebase-dataconnect + +* dataconnect: include relevant logcat snippets in github actions logs when androidTest tests fail (#6902) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6902) [commit](https://github.com/firebase/firebase-android-sdk/commit/88f50d5744a90a165c00329991d630a1a7071cd1) [Denver Coneybeare] + +* FirebaseDataConnectImpl.kt: use MutableStateFlow to store state, rather than mutexes (#6861) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6861) [commit](https://github.com/firebase/firebase-android-sdk/commit/534cc539ff919ad6078021832007cbec0ec1258b) [Denver Coneybeare] + +* dataconnect: use firebase-tools to launch fdc emulator instead of launching it directly (#6896) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6896) [commit](https://github.com/firebase/firebase-android-sdk/commit/fd6553969b374f325d1340698504ecbf3f58ecfa) [Denver Coneybeare] + +* dataconnect: create python script to post comments about scheduled runs (#6880) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6880) [commit](https://github.com/firebase/firebase-android-sdk/commit/bd2cb5f1d6cef61fd88845e5ca29b229188d3ad5) [Denver Coneybeare] + +* dataconnect: Improve usage of MutableStateFlow to improve readability (#6840) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6840) [commit](https://github.com/firebase/firebase-android-sdk/commit/51b4a1c3c03608ad40555113e1189b64dd12505c) [Denver Coneybeare] + +* dataconnect: AuthIntegrationTest.kt: add missing import for FirebaseDataConnectInternal (#6854) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6854) [commit](https://github.com/firebase/firebase-android-sdk/commit/210dc0279ee974fac677f2aa7cc50d26586aea7d) [Denver Coneybeare] + +* dataconnect: auth code internal cleanup (#6836) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6836) [commit](https://github.com/firebase/firebase-android-sdk/commit/dbf5d014ab08cf3d86b6e31d2650afad451fdb3c) [Denver Coneybeare] + +* dataconnect: fix two flaky tests due to their failure to wait for FirebaseAuth to be initialized (#6835) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6835) [commit](https://github.com/firebase/firebase-android-sdk/commit/f826b40e84d1d58e895fc882a5131de9a9859042) [Denver Coneybeare] + +* dataconnect: fix flaky test that ensures deserialize() throws IllegalArgumentException on invalid input (#6839) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6839) [commit](https://github.com/firebase/firebase-android-sdk/commit/8af38c9599656d022b701b2304537a47a7bf6f35) [Denver Coneybeare] + +* dataconnect: QuerySubscriptionIntegrationTest.kt: fix flaky test using backgroundScope (#6827) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6827) [commit](https://github.com/firebase/firebase-android-sdk/commit/75cdf963195c873151a6fe0ece181543c01cea5f) [Denver Coneybeare] + +* Update changelog file (#6825) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6825) [commit](https://github.com/firebase/firebase-android-sdk/commit/2cdac31dc2d9510c158596ebec4ce7ddba327eb5) [Rodrigo Lazo] + +## firebase-firestore + +* Handle error when stream was cancelled prior to calling halfClose. (#6894) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6894) [commit](https://github.com/firebase/firebase-android-sdk/commit/fda3351722f16582024249bb7d336ca46f2d4068) [Tom Andersen] + +* fix: Improve efficiency of online/offline composite index tests. (#6868) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6868) [commit](https://github.com/firebase/firebase-android-sdk/commit/24fba9b55f2ba7c4a821bd2fa835cd1e0a97d8d4) [Ehsan] + +* fix: remove null value inclusion from `whereNotEqualTo` and `whereNotIn` filter results (#6859) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6859) [commit](https://github.com/firebase/firebase-android-sdk/commit/edcea54ea570af828f31cf5f54e952ad6c32ff61) [Mila] + +* Improve the integration test coverage for online vs offline comparisons. (#6841) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6841) [commit](https://github.com/firebase/firebase-android-sdk/commit/70c8e89dbc6698346a612d926da8f6bf1ddf6797) [Ehsan] + +## firebase-firestore/ktx + + +## firebase-storage + +* [Storage] Migrate from Robolectric.flushForegroundThreadScheduler to ShadowLooper.runToEndOfTasks (#6927) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6927) [commit](https://github.com/firebase/firebase-android-sdk/commit/4c4c7c93b08bb0ba78b3e99cb00a50469c6eab24) [Rodrigo Lazo] + +## firebase-storage/ktx + + +## firebase-vertexai + +* Prepare VertexAI SDK for release (#6941) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6941) [commit](https://github.com/firebase/firebase-android-sdk/commit/7b1855d1b60dfa886bd5e54b7793c008dee361b5) [Daymon] + +* Add Java VertexAI bidi compile tests (#6903) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6903) [commit](https://github.com/firebase/firebase-android-sdk/commit/4b12b337c1291de22fe35322c9575bdadbc74129) [emilypgoogle] + +* Fix AI test timeout (#6917) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6917) [commit](https://github.com/firebase/firebase-android-sdk/commit/7b7e11ea5eafbcda1fcaa8ab1752b7cfaf11e425) [Daymon] + +* encodeBitmapToBase64Png -> encodeBitmapToBase64Jpeg (#6912) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6912) [commit](https://github.com/firebase/firebase-android-sdk/commit/12127e6ec6a5e0e1264e248c5ba7fe7e7711595f) [David Motsonashvili] + +* Migrate LiveContentResponse.Status to properties (#6906) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6906) [commit](https://github.com/firebase/firebase-android-sdk/commit/4fb4dfd197832035675b28320e09fb9105aa3639) [Daymon] + +* Refactor: Rename encodeBitmapToBase64Png to encodeBitmapToBase64Jpeg (#6905) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6905) [commit](https://github.com/firebase/firebase-android-sdk/commit/d568e844fc79853a8a6c5b1a3819ef27d150f597) [Rodrigo Lazo] + +* Enable multimodal response generation in android (#6901) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6901) [commit](https://github.com/firebase/firebase-android-sdk/commit/e9ef4799062b76b8a533c3ae0fe25d6d6b29a59d) [Vinay Guthal] + +* Refactor live bidi (#6870) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6870) [commit](https://github.com/firebase/firebase-android-sdk/commit/40b7637c6c4e246113b781ba5be3f1a7356678de) [Daymon] + +* Update LiveModelFutures to return LiveSessionFutures instead of LiveSession (#6834) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6834) [commit](https://github.com/firebase/firebase-android-sdk/commit/47e37b5802a1be2038bc392dadb9a88c4cec8dbe) [Vinay Guthal] + +* update javadocs (#6848) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6848) [commit](https://github.com/firebase/firebase-android-sdk/commit/33e989f2f162348a2b75c19cbc8ce962e3d14264) [Vinay Guthal] + +* upate release notes (#6837) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6837) [commit](https://github.com/firebase/firebase-android-sdk/commit/d7a56a1e56699b8ea0ccd8bb752b702be2b39cf1) [Vinay Guthal] + +* Add support for HarmBlockThreshold.OFF (#6843) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6843) [commit](https://github.com/firebase/firebase-android-sdk/commit/9e89b289be79a8d7892db08be16d77e6a81eea45) [Daymon] + +* use bytestream instead of bytearray (#6847) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6847) [commit](https://github.com/firebase/firebase-android-sdk/commit/6e3be7893e600014e855d8ca2b511c3681bbd7c2) [Vinay Guthal] + +* fix emulator listening to itself (#6823) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6823) [commit](https://github.com/firebase/firebase-android-sdk/commit/395e9dd51107bfb1057c220a847b6f420a250beb) [Vinay Guthal] + +* Bidirectional Streaming Android (#6759) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6759) [commit](https://github.com/firebase/firebase-android-sdk/commit/d2e72df5231cfe0a8067e139ce60aa108992972d) [Vinay Guthal] + +* Add basic Vertex Java compilation tests (#6810) + [pr](https://github.com/firebase/firebase-android-sdk/pull/6810) [commit](https://github.com/firebase/firebase-android-sdk/commit/dbeecd4df3803d14e885b011e5998129c87cfd87) [emilypgoogle] + + +## SDKs with changes, but no changelogs +:firebase-functions +:firebase-functions:ktx +:firebase-perf +:firebase-perf:ktx +:protolite-well-known-types \ No newline at end of file