Skip to content

Conversation

@andrewheard
Copy link
Contributor

Replaced gemini-2.0-flash-001 with gemini-2.5-flash-lite and, more importantly, replaced imagen-3.0-generate-002 with imagen-4.0-fast-generate-001. Imagen 3 is deprecated on the Gemini Developer API as of 2025-11-10.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @andrewheard, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on updating the AI models used within the Firebase AI example application. The primary goal is to ensure compatibility and leverage the latest capabilities by migrating from older model versions, particularly addressing the upcoming deprecation of Imagen 3.0, and improving the Gemini model integration.

Highlights

  • Gemini Model Update: The gemini-2.0-flash-001 model has been replaced with the newer gemini-2.5-flash-lite across various example screens and view models.
  • Imagen Model Update and Deprecation: The imagen-3.0-generate-002 model has been upgraded to imagen-4.0-fast-generate-001. This change is crucial as Imagen 3.0 is slated for deprecation on the Gemini Developer API by November 10, 2025.
  • Imagen Aspect Ratio Adjustment: The default aspect ratio for image generation in the Imagen example has been updated from landscape4x3 to square1x1 to align with the new Imagen 4.0 model.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the Gemini and Imagen models to newer versions, which is an important update to keep the example app current and avoid using deprecated models. The changes look good. My main feedback is to consider centralizing the model name strings. Currently, they are duplicated across multiple files, which makes updates like this one more tedious and error-prone. Defining them as constants in a single place would significantly improve the code's maintainability.

init(firebaseService: FirebaseAI, title: String, searchGroundingEnabled: Bool = false) {
let model = firebaseService.generativeModel(
modelName: "gemini-2.0-flash-001",
modelName: "gemini-2.5-flash-lite",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This pull request updates the model name gemini-2.0-flash-001 to gemini-2.5-flash-lite in 5 different files. This highlights that having the model name as a hardcoded string literal in multiple places is a maintenance burden. To improve maintainability and reduce code duplication, consider defining these model names as constants in a centralized location.

For example, you could create a struct to hold all model names:

// In a new file, e.g., ModelConstants.swift
struct ModelNames {
  static let geminiFlash = "gemini-2.5-flash-lite"
  static let imagen4 = "imagen-4.0-fast-generate-001"
}

Then you could use it like this: modelName: ModelNames.geminiFlash. This would make future model updates much simpler and less error-prone.


init(firebaseService: FirebaseAI) {
let modelName = "imagen-3.0-generate-002"
let modelName = "imagen-4.0-fast-generate-001"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The Imagen model name is also hardcoded here. To improve maintainability, it would be beneficial to centralize this string literal into a shared constants structure, as suggested for the Gemini models. This would make it easier to manage and update model versions in the future.

Using a centralized constant like ModelNames.imagen4 (as proposed in my other comment) would be ideal.

var generationConfig = ImagenGenerationConfig()
generationConfig.numberOfImages = 4
generationConfig.aspectRatio = .landscape4x3
generationConfig.aspectRatio = .square1x1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I switched this to 1:1 since the images are square in the UI and looked stretched:

Copy link
Member

@paulb777 paulb777 left a comment

Choose a reason for hiding this comment

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

Let's talk again about adding the enum ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants