Skip to content

Conversation

@takahirom
Copy link
Contributor

Thanks for this awesome reference app! I'm going to talk about this app in DevFest Tokyo.

While exploring the codebase, I noticed that Androidify uses Gemini Nano for image validation (validateImageHasEnoughInformation) with a fallback to Firebase AI, but prompt validation
(validatePromptHasEnoughInformation) only uses Firebase AI directly.

I'm curious about the Gemini Nano strategy here. Is there a specific reason why prompt validation doesn't leverage Gemini Nano? If not, this PR adds Gemini Nano support for prompt validation to maintain
consistency with the existing image validation pattern.

Changes

  • Added promptTextVerifyNano() to RemoteConfigDataSource with validation prompt
  • Added validatePromptHasEnoughInformation() to GeminiNanoGenerationDataSource
  • Updated ImageGenerationRepository to try Gemini Nano first, then fallback to Firebase AI
  • Updated test mocks

Let me know if there's a specific reason this pattern wasn't used for prompt validation!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @takahirom, 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 integrates Gemini Nano into the prompt validation workflow, mirroring the existing image validation strategy. Previously, prompt validation exclusively used Firebase AI, while image validation leveraged Gemini Nano with a Firebase AI fallback. This change introduces Gemini Nano as the primary validation method for prompts, with Firebase AI serving as a robust backup, ensuring consistency across validation processes and potentially enhancing performance or capabilities.

Highlights

  • Gemini Nano Integration for Prompt Validation: Introduced Gemini Nano support for validating text prompts, aligning with the existing image validation pattern.
  • Fallback Mechanism: Implemented a fallback to Firebase AI for prompt validation if Gemini Nano is not successful or enabled.
  • New Remote Config Key: Added "promptTextVerifyNano" to RemoteConfigDataSource to fetch the specific prompt for Gemini Nano text validation.
  • Updated Repository Logic: Modified ImageGenerationRepository to prioritize Gemini Nano for prompt validation before falling back to Firebase AI.
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 is a great addition, bringing consistency to the app by adding Gemini Nano support for prompt validation with a fallback mechanism, similar to the existing image validation. The changes are well-structured, including updates to data sources, remote config, and tests.

I've left a couple of suggestions. One is a high-severity recommendation to improve the fallback logic to be more robust, ensuring it triggers not just when Nano is unavailable, but also when Nano's validation fails. This aligns better with the likely intent and improves reliability. The other is a minor suggestion for code conciseness.

Overall, excellent work on improving the app's on-device capabilities!

@takahirom
Copy link
Contributor Author

takahirom commented Nov 9, 2025

Just in case, I've verified that it works.

valid case invalid case
image image

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.

1 participant