Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai-catalog/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencies {
implementation(libs.hilt.android)
implementation(libs.hilt.navigation.compose)
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.vertexai)
implementation(libs.firebase.ai)
ksp(libs.hilt.compiler)

implementation(project(":samples:gemini-multimodal"))
Expand Down
4 changes: 2 additions & 2 deletions ai-catalog/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
agp = "8.8.0"
coilCompose = "3.1.0"
firebaseBom = "33.12.0"
firebaseBom = "33.14.0"
mlkitGenAi = "1.0.0-beta1"
kotlin = "2.1.0"
coreKtx = "1.15.0"
Expand Down Expand Up @@ -31,7 +31,7 @@ uiToolingPreviewAndroid = "1.8.1"
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
firebase-vertexai = { group = "com.google.firebase", name = "firebase-vertexai" }
firebase-ai = { module = "com.google.firebase:firebase-ai" }
firebase-common-ktx = { group = "com.google.firebase", name = "firebase-common-ktx", version.ref = "firebaseCommonKtx" }
genai-image-description = { module = "com.google.mlkit:genai-image-description", version.ref = "mlkitGenAi" }
genai-proofreading = { module = "com.google.mlkit:genai-proofreading", version.ref = "mlkitGenAi" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.google.firebase.Firebase
import com.google.firebase.vertexai.type.ImagenAspectRatio
import com.google.firebase.vertexai.type.ImagenGenerationConfig
import com.google.firebase.vertexai.type.ImagenImageFormat
import com.google.firebase.ai.type.ImagenAspectRatio
import com.google.firebase.ai.type.ImagenGenerationConfig
import com.google.firebase.ai.type.ImagenImageFormat
import com.google.firebase.vertexai.type.PublicPreviewAPI
import com.google.firebase.vertexai.vertexAI
import com.google.firebase.ai.ai
import com.google.firebase.ai.type.GenerativeBackend
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand All @@ -41,7 +42,7 @@ class ImagenViewModel @Inject constructor(): ViewModel() {
val isGenerating: LiveData<Boolean> = _isGenerating

@OptIn(PublicPreviewAPI::class)
private val imagenModel = Firebase.vertexAI.imagenModel(
private val imagenModel = Firebase.ai(backend = GenerativeBackend.vertexAI()).imagenModel(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Thanks for updating the imagenModel initialization to use the new firebase-ai SDK!

This model (and its initialization here on line 45) is annotated with @OptIn(PublicPreviewAPI::class) (as seen on line 44). I notice the PublicPreviewAPI annotation itself is still imported from com.google.firebase.vertexai.type (line 29).

With the migration to firebase-ai, could you clarify if this is the expected source for the PublicPreviewAPI annotation? It would be helpful to confirm whether the new firebase-ai SDK provides its own version of this annotation for preview features, or if this interdependency with the com.google.firebase.vertexai.type namespace is the intended approach for now. Ensuring all related types and annotations align with the new SDK's structure, where possible, would enhance clarity and future maintainability.

modelName = "imagen-3.0-generate-002",
generationConfig = ImagenGenerationConfig(
numberOfImages = 1,
Expand Down