-
Notifications
You must be signed in to change notification settings - Fork 46
[FirebaseAI] Add heartbeat info #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @a-maurice, 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!
Summary of Changes
This pull request adds FirebaseAI to the heartbeat logic. It achieves this by using reflection to determine if FirebaseAI is present and then adding the appropriate user agent. The change modifies app/src/swig/app.i
to include this new functionality.
Highlights
- FirebaseAI Heartbeat: Adds FirebaseAI to the heartbeat logic to ensure proper user agent reporting.
- Reflection: Uses reflection to check for the presence of FirebaseAI, avoiding direct dependencies.
- User Agent: Adds the 'fire-vertex' user agent if FirebaseAI is detected.
Changelog
- app/src/swig/app.i
- Added a try-catch block to handle potential exceptions during reflection.
- Implemented reflection logic to find the FirebaseAI class.
- Added 'fire-vertex' to the user agent map if FirebaseAI is found.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 is currently in preview and 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 to provide feedback.
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.
Through reflection's art,
FirebaseAI finds its heart,
A user agent's call,
For one and for all,
In heartbeat's gentle start.
Footnotes
-
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. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request adds FirebaseAI to the heartbeat logic using reflection. This approach allows the app to detect the presence of FirebaseAI without creating a direct dependency. The changes look good overall, but there are a few areas that could be improved for clarity and robustness.
Summary of Findings
- Exception Handling: The
catch
block is empty, which can mask potential issues. It's better to log the exception or handle it in some way to understand why the reflection might be failing. - User Agent Key: The user agent key
fire-vertex
might not be descriptive enough. Consider using a more specific key that clearly indicates it's related to FirebaseAI. - Reflection Performance: Reflection can be expensive. Consider caching the result of the FirebaseAI check to avoid repeated reflection calls.
Merge Readiness
The pull request is almost ready for merging. I recommend addressing the exception handling and user agent key suggestions to improve the robustness and clarity of the code. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. Given the medium
severity issues, I recommend that the pull request not be merged until those are addressed.
// logic needs to check for it here, using reflection. | ||
const string firebaseAIClassName = "Firebase.AI.FirebaseAI"; | ||
// Iterate over the loaded assemblies, since we don't have a known DLL name. | ||
foreach (var assembly in System.AppDomain.CurrentDomain.GetAssemblies()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Apple, if there's a way to associate an Objective-C class and method with the library, we could potentially extend the code at https://github.com/firebase/firebase-ios-sdk/blob/main/FirebaseCore/Sources/FIRApp.m#L816 to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is what inspired me to do it this way. It is assuming the "FirebaseAI" class will be there, so maybe I should use another name in case that changes, but since that is a public facing class it isn't likely to change, so I think it should be fine.
Description
Add FirebaseAI to heartbeat logic, by using reflection in App to determine if FirebaseAI is present, and adding the appropriate user agent.
Testing
https://github.com/firebase/firebase-unity-sdk/actions/runs/14914214976
Type of Change
Place an
x
the applicable box: