| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f79bfbf commit 092d67d
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,13 @@ | |||
| 1 | 1 | # Unreleased | |
| 2 | 2 | ||
| 3 | + - [changed] Deprecated `GenerativeBackend.vertexAI` in favor of | ||
| 4 | + `GenerativeBackend.agentPlatform` to reflect the renaming of Vertex | ||
| 5 | + AI to Gemini Enterprise Agent Platform. (#8437) | ||
| 6 | + | ||
| 7 | + Note: The default location is now `global` instead of `us-central1` (no other | ||
| 8 | + functionality has changed). To continue using `us-central1`, specify | ||
| 9 | + `GenerativeBackend.agentPlatform(location = "us-central1"))`. | ||
| 10 | + | ||
| 3 | 11 | # 17.14.0 | |
| 4 | 12 | ||
| 5 | 13 | - [feature] Added static factory methods `createWithThinking` for `Part` implementations to expose `thoughtSignature` and `isThought` properties. (#8352) | |
@@ -190,4 +198,3 @@ using [specific Gemini models](/docs/vertex-ai/models). | |||
| 190 | 198 | ||
| 191 | 199 | Note: This feature is in Public Preview, which means that it is not subject to any SLA or | |
| 192 | 200 | deprecation policy and could change in backwards-incompatible ways. | |
| 193 | - | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -787,16 +787,20 @@ package com.google.firebase.ai.type { | |||
| 787 | 787 | } | |
| 788 | 788 | ||
| 789 | 789 | public final class GenerativeBackend { | |
| 790 | + method public static com.google.firebase.ai.type.GenerativeBackend agentPlatform(); | ||
| 791 | + method public static com.google.firebase.ai.type.GenerativeBackend agentPlatform(String location = "global"); | ||
| 790 | 792 | method public static com.google.firebase.ai.type.GenerativeBackend googleAI(); | |
| 791 | - method public static com.google.firebase.ai.type.GenerativeBackend vertexAI(); | ||
| 792 | - method public static com.google.firebase.ai.type.GenerativeBackend vertexAI(String location = "us-central1"); | ||
| 793 | + method @Deprecated public static com.google.firebase.ai.type.GenerativeBackend vertexAI(); | ||
| 794 | + method @Deprecated public static com.google.firebase.ai.type.GenerativeBackend vertexAI(String location = "us-central1"); | ||
| 793 | 795 | field public static final com.google.firebase.ai.type.GenerativeBackend.Companion Companion; | |
| 794 | 796 | } | |
| 795 | 797 | ||
| 796 | 798 | public static final class GenerativeBackend.Companion { | |
| 799 | + method public com.google.firebase.ai.type.GenerativeBackend agentPlatform(); | ||
| 800 | + method public com.google.firebase.ai.type.GenerativeBackend agentPlatform(String location = "global"); | ||
| 797 | 801 | method public com.google.firebase.ai.type.GenerativeBackend googleAI(); | |
| 798 | - method public com.google.firebase.ai.type.GenerativeBackend vertexAI(); | ||
| 799 | - method public com.google.firebase.ai.type.GenerativeBackend vertexAI(String location = "us-central1"); | ||
| 802 | + method @Deprecated public com.google.firebase.ai.type.GenerativeBackend vertexAI(); | ||
| 803 | + method @Deprecated public com.google.firebase.ai.type.GenerativeBackend vertexAI(String location = "us-central1"); | ||
| 800 | 804 | } | |
| 801 | 805 | ||
| 802 | 806 | public final class GoogleMaps { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,5 +12,5 @@ | |||
| 12 | 12 | # See the License for the specific language governing permissions and | |
| 13 | 13 | # limitations under the License. | |
| 14 | 14 | ||
| 15 | - version=17.14.1 | ||
| 15 | + version=17.15.0 | ||
| 16 | 16 | latestReleasedVersion=17.14.0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -117,7 +117,8 @@ internal constructor( | |||
| 117 | 117 | ): GenerativeModel { | |
| 118 | 118 | val modelUri = | |
| 119 | 119 | when (backend.backend) { | |
| 120 | - GenerativeBackendEnum.VERTEX_AI -> | ||
| 120 | + GenerativeBackendEnum.VERTEX_AI, | ||
| 121 | + GenerativeBackendEnum.AGENT_PLATFORM -> | ||
| 121 | 122 | "projects/${firebaseApp.options.projectId}/locations/${backend.location}/publishers/google/models/${modelName}" | |
| 122 | 123 | GenerativeBackendEnum.GOOGLE_AI -> | |
| 123 | 124 | "projects/${firebaseApp.options.projectId}/models/${modelName}" | |
@@ -213,7 +214,8 @@ internal constructor( | |||
| 213 | 214 | } | |
| 214 | 215 | return LiveGenerativeModel( | |
| 215 | 216 | when (backend.backend) { | |
| 216 | - GenerativeBackendEnum.VERTEX_AI -> | ||
| 217 | + GenerativeBackendEnum.VERTEX_AI, | ||
| 218 | + GenerativeBackendEnum.AGENT_PLATFORM -> | ||
| 217 | 219 | "projects/${firebaseApp.options.projectId}/locations/${backend.location}/publishers/google/models/${modelName}" | |
| 218 | 220 | GenerativeBackendEnum.GOOGLE_AI -> | |
| 219 | 221 | "projects/${firebaseApp.options.projectId}/models/${modelName}" | |
@@ -252,7 +254,8 @@ internal constructor( | |||
| 252 | 254 | ): ImagenModel { | |
| 253 | 255 | val modelUri = | |
| 254 | 256 | when (backend.backend) { | |
| 255 | - GenerativeBackendEnum.VERTEX_AI -> | ||
| 257 | + GenerativeBackendEnum.VERTEX_AI, | ||
| 258 | + GenerativeBackendEnum.AGENT_PLATFORM -> | ||
| 256 | 259 | "projects/${firebaseApp.options.projectId}/locations/${backend.location}/publishers/google/models/${modelName}" | |
| 257 | 260 | GenerativeBackendEnum.GOOGLE_AI -> | |
| 258 | 261 | "projects/${firebaseApp.options.projectId}/models/${modelName}" | |
@@ -358,7 +361,8 @@ internal constructor( | |||
| 358 | 361 | ||
| 359 | 362 | private fun getTemplateUri(backend: GenerativeBackend): String = | |
| 360 | 363 | when (backend.backend) { | |
| 361 | - GenerativeBackendEnum.VERTEX_AI -> | ||
| 364 | + GenerativeBackendEnum.VERTEX_AI, | ||
| 365 | + GenerativeBackendEnum.AGENT_PLATFORM -> | ||
| 362 | 366 | "projects/${firebaseApp.options.projectId}/locations/${backend.location}/templates/" | |
| 363 | 367 | GenerativeBackendEnum.GOOGLE_AI -> "projects/${firebaseApp.options.projectId}/templates/" | |
| 364 | 368 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -249,6 +249,7 @@ internal constructor( | |||
| 249 | 249 | private fun getBidiEndpoint(location: String): String = | |
| 250 | 250 | when (backend?.backend) { | |
| 251 | 251 | GenerativeBackendEnum.VERTEX_AI, | |
| 252 | + GenerativeBackendEnum.AGENT_PLATFORM, | ||
| 252 | 253 | null -> | |
| 253 | 254 | "wss://firebasevertexai.googleapis.com/ws/google.firebase.vertexai.v1beta.LlmBidiService/BidiGenerateContent/locations/$location?key=$key" | |
| 254 | 255 | GenerativeBackendEnum.GOOGLE_AI -> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -121,7 +121,8 @@ internal class CloudGenerativeModelProvider( | |||
| 121 | 121 | when (generativeBackend.backend) { | |
| 122 | 122 | GenerativeBackendEnum.GOOGLE_AI -> | |
| 123 | 123 | CountTokensRequest.forGoogleAI(buildGenerateContentRequest(prompt)) | |
| 124 | - GenerativeBackendEnum.VERTEX_AI -> | ||
| 124 | + GenerativeBackendEnum.VERTEX_AI, | ||
| 125 | + GenerativeBackendEnum.AGENT_PLATFORM -> | ||
| 125 | 126 | CountTokensRequest.forVertexAI(buildGenerateContentRequest(prompt)) | |
| 126 | 127 | } | |
| 127 | 128 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,12 @@ internal constructor(internal val location: String, internal val backend: Genera | |||
| 33 | 33 | * | |
| 34 | 34 | * @param location passes a valid cloud server location, defaults to "us-central1" | |
| 35 | 35 | */ | |
| 36 | + @Deprecated( | ||
| 37 | + message = | ||
| 38 | + "Use agentPlatform instead. Note that agentPlatform default location is \"global\" while" + | ||
| 39 | + " vertexAI was \"us-central1\".", | ||
| 40 | + replaceWith = ReplaceWith("agentPlatform(location)") | ||
| 41 | + ) | ||
| 36 | 42 | @JvmStatic | |
| 37 | 43 | @JvmOverloads | |
| 38 | 44 | public fun vertexAI(location: String = "us-central1"): GenerativeBackend { | |
@@ -41,6 +47,20 @@ internal constructor(internal val location: String, internal val backend: Genera | |||
| 41 | 47 | } | |
| 42 | 48 | return GenerativeBackend(location, GenerativeBackendEnum.VERTEX_AI) | |
| 43 | 49 | } | |
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * References the Gemini Enterprise Agent Platform backend. | ||
| 53 | + * | ||
| 54 | + * @param location passes a valid cloud server location, defaults to "global" | ||
| 55 | + */ | ||
| 56 | + @JvmStatic | ||
| 57 | + @JvmOverloads | ||
| 58 | + public fun agentPlatform(location: String = "global"): GenerativeBackend { | ||
| 59 | + if (location.isBlank() || location.contains("/")) { | ||
| 60 | + throw InvalidLocationException(location) | ||
| 61 | + } | ||
| 62 | + return GenerativeBackend(location, GenerativeBackendEnum.AGENT_PLATFORM) | ||
| 63 | + } | ||
| 44 | 64 | } | |
| 45 | 65 | ||
| 46 | 66 | override fun equals(other: Any?): Boolean { | |
@@ -49,7 +69,8 @@ internal constructor(internal val location: String, internal val backend: Genera | |||
| 49 | 69 | GenerativeBackendEnum.GOOGLE_AI -> { | |
| 50 | 70 | other.backend == this.backend | |
| 51 | 71 | } | |
| 52 | - GenerativeBackendEnum.VERTEX_AI -> { | ||
| 72 | + GenerativeBackendEnum.VERTEX_AI, | ||
| 73 | + GenerativeBackendEnum.AGENT_PLATFORM -> { | ||
| 53 | 74 | other.backend == this.backend && other.location == this.location | |
| 54 | 75 | } | |
| 55 | 76 | } | |
@@ -63,4 +84,5 @@ internal constructor(internal val location: String, internal val backend: Genera | |||
| 63 | 84 | internal enum class GenerativeBackendEnum { | |
| 64 | 85 | GOOGLE_AI, | |
| 65 | 86 | VERTEX_AI, | |
| 87 | + AGENT_PLATFORM, | ||
| 66 | 88 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,77 @@ | |||
| 1 | + /* | ||
| 2 | + * Copyright 2026 Google LLC | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | + package com.google.firebase.ai.type | ||
| 18 | + | ||
| 19 | + import io.kotest.assertions.throwables.shouldThrow | ||
| 20 | + import io.kotest.matchers.shouldBe | ||
| 21 | + import io.kotest.matchers.shouldNotBe | ||
| 22 | + import org.junit.Test | ||
| 23 | + | ||
| 24 | + internal class GenerativeBackendTest { | ||
| 25 | + | ||
| 26 | + @Test | ||
| 27 | + fun `agentPlatform default location`() { | ||
| 28 | + val backend = GenerativeBackend.agentPlatform() | ||
| 29 | + backend.location shouldBe "global" | ||
| 30 | + backend.backend shouldBe GenerativeBackendEnum.AGENT_PLATFORM | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Test | ||
| 34 | + fun `agentPlatform custom location`() { | ||
| 35 | + val backend = GenerativeBackend.agentPlatform("europe-west1") | ||
| 36 | + backend.location shouldBe "europe-west1" | ||
| 37 | + backend.backend shouldBe GenerativeBackendEnum.AGENT_PLATFORM | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Test | ||
| 41 | + fun `agentPlatform invalid locations throw exception`() { | ||
| 42 | + shouldThrow<InvalidLocationException> { GenerativeBackend.agentPlatform("") } | ||
| 43 | + shouldThrow<InvalidLocationException> { GenerativeBackend.agentPlatform(" ") } | ||
| 44 | + shouldThrow<InvalidLocationException> { GenerativeBackend.agentPlatform("us/central1") } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Test | ||
| 48 | + @Suppress("DEPRECATION") | ||
| 49 | + fun `vertexAI default location`() { | ||
| 50 | + val backend = GenerativeBackend.vertexAI() | ||
| 51 | + backend.location shouldBe "us-central1" | ||
| 52 | + backend.backend shouldBe GenerativeBackendEnum.VERTEX_AI | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Test | ||
| 56 | + fun `googleAI properties`() { | ||
| 57 | + val backend = GenerativeBackend.googleAI() | ||
| 58 | + backend.location shouldBe "" | ||
| 59 | + backend.backend shouldBe GenerativeBackendEnum.GOOGLE_AI | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Test | ||
| 63 | + @Suppress("DEPRECATION") | ||
| 64 | + fun `GenerativeBackend equality and hashcode`() { | ||
| 65 | + val agentPlatformGlobal1 = GenerativeBackend.agentPlatform("global") | ||
| 66 | + val agentPlatformGlobal2 = GenerativeBackend.agentPlatform("global") | ||
| 67 | + val agentPlatformUsCentral = GenerativeBackend.agentPlatform("us-central1") | ||
| 68 | + val vertexGlobal = GenerativeBackend.vertexAI("global") | ||
| 69 | + | ||
| 70 | + agentPlatformGlobal1 shouldBe agentPlatformGlobal2 | ||
| 71 | + agentPlatformGlobal1.hashCode() shouldBe agentPlatformGlobal2.hashCode() | ||
| 72 | + | ||
| 73 | + agentPlatformGlobal1 shouldNotBe agentPlatformUsCentral | ||
| 74 | + agentPlatformGlobal1 shouldNotBe vertexGlobal | ||
| 75 | + agentPlatformGlobal1 shouldNotBe GenerativeBackend.googleAI() | ||
| 76 | + } | ||
| 77 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments