Update FirebaseAI quickstart to use agentPlatform - #1866
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the backend option from "Firebase Vertex AI" (.vertexAI) to "Agent Platform Gemini API" (.agentPlatform) across multiple view models in the Firebase AI example application. The review feedback identifies a potential issue in MultimodalViewModel.swift where an empty but non-nil fileDataParts array evaluates to true, causing local attachments to be ignored. It is recommended to add a !fileDataParts.isEmpty check to ensure the application correctly falls back to processing local attachments when no Cloud Storage parts are present.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request migrates the backend option from Vertex AI to the Agent Platform Gemini API across multiple view models. In MultimodalViewModel.swift, the logic is updated to check for .agentPlatform and verify that fileDataParts is not empty. The review feedback points out an issue in MultimodalViewModel.swift where local attachments are silently ignored when fileDataParts is not empty under the .agentPlatform backend, and provides a code suggestion to correctly process and append local attachments.
| let firebaseService = backendType == .googleAI | ||
| ? FirebaseAI.firebaseAI(backend: .googleAI()) | ||
| : FirebaseAI.firebaseAI(backend: .vertexAI(location: "global")) | ||
| : FirebaseAI.firebaseAI(backend: .agentPlatform(location: "global")) |
There was a problem hiding this comment.
We don't need the location setting anymore for the Agent Platform syntax (especially if it's just setting to global)... wanna remove it?
Note that we DO need to keep the location setting for the Live models. It must be explicitly set to us-central1.
| @@ -16,7 +16,7 @@ import Foundation | |||
|
|
|||
| enum BackendOption: String, CaseIterable, Identifiable { | |||
| case googleAI = "Google AI" | |||
There was a problem hiding this comment.
out of scope for this PR, but noting it so that it can be updated
Should this be:
case googleAI = "Gemini Developer API"
|
Feedback addressed in #1867 |
Updates vertexAI to agentPlatform after its introduction in Firebase Apple SDK 12.17.0.