[AI] Add hybrid support with Foundation Models - #16111
Conversation
Using Gemini Code AssistThe 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
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 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. |
Generated by 🚫 Danger |
Summary of ChangesThis pull request integrates Apple's Foundation Models framework into the Firebase AI SDK, enabling on-device language model inference. By conforming the system model to the existing Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Activity
|
There was a problem hiding this comment.
Code Review
This pull request integrates Apple's Foundation Models framework into FirebaseAI, enabling on-device language model support via the new SystemLanguageModel. The changes include session management for on-device models, prompt conversion logic, and tool compatibility validation. Review feedback suggests ensuring consistent platform support by adding visionOS 26.0 to several @available attributes and refactoring the _hasHistory property to use more idiomatic Swift.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request integrates Apple's Foundation Models into the FirebaseAI framework, introducing the SystemLanguageModel and support for hybrid model configurations. The changes include session management, response streaming, and prompt conversion logic for on-device models, along with updated tool compatibility checks and integration tests. Review feedback identifies missing visionOS 26.0 availability markers in several files, recommending their addition for consistency with the rest of the platform support implementation.
There was a problem hiding this comment.
Code Review
This pull request integrates Apple's Foundation Models framework into Firebase AI, enabling the use of on-device system language models. It introduces SystemLanguageModel as a LanguageModel provider, implements session management, and provides conversion logic for prompts and tools. A critical issue was identified in the _startSession implementation where the LanguageModelSession initializer is missing a required model argument, which will lead to a compilation error. Additionally, feedback suggests using TextPart for better consistency with the public API and improving documentation regarding the current limitation of only supporting text-based prompt parts.
There was a problem hiding this comment.
Code Review
This pull request integrates Apple's Foundation Models into the Firebase AI SDK to support on-device language model sessions. It implements the necessary protocols for LanguageModelSession, adds a SystemLanguageModel provider, and includes logic for prompt and tool conversion. Integration tests for hybrid model fallbacks and unit tests for session initialization are also included. Feedback was provided to improve the robustness of tool compatibility checks by throwing errors instead of using assertions.
Conformed
FirebaseAI.SystemLanguageModeltoLanguageModelto add support for on-device inference using the Foundation Models framework. This allowsFirebaseAI.SystemLanguageModelto be used in aHybridModelfor hybrid inference locally and in the cloud with Gemini.#no-changelog