refactor(ai): Use GenerativeAIService in GeminiLanguageModel#16284
refactor(ai): Use GenerativeAIService in GeminiLanguageModel#16284andrewheard wants to merge 4 commits into
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 the 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 counterproductive. 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. |
Summary of ChangesThis pull request refactors the GeminiLanguageModel to interact directly with the GenerativeAIService, streamlining the request construction process by handling GenerateContentRequest internally. Additionally, it updates platform availability annotations across several components to support newer OS versions and improves test robustness regarding error handling. Highlights
New Features🧠 You can now enable Memory (public preview) 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 expands platform support for FoundationModels (specifically adding watchOS 27.0 support) and refactors GeminiLanguageModel and its executor to directly utilize GenerativeAIService and GenerateContentRequest instead of routing through FirebaseAI. The review feedback correctly highlights critical compilation risks: simplifying the compilation guards to only check the compiler version (e.g., #if compiler(>=6.4)) without verifying canImport(FoundationModels) and IS_FOUNDATION_MODELS_SUPPORTED_PLATFORM will cause build failures on unsupported platforms. It is highly recommended to restore these conditional checks and update their corresponding #endif comments across the modified files.
paulb777
left a comment
There was a problem hiding this comment.
Not blocking for this PR, but should we add integration tests for Foundation Models, even if they can't run in CI yet?
@paulb777 They aren't extensive yet but we do have some: https://github.com/firebase/firebase-ios-sdk/blob/wwdc26-preview-dev/FirebaseAI/Tests/TestApp/Tests/Integration/GeminiLanguageModelTests.swift |
Refactored
GeminiLanguageModelto directly callGenerativeAIServiceinstead of going throughGenerativeModel.GeminiLanguageModelnow holds an instance of theGenerativeAIServiceand constructs theGenerateContentRequestitself.#no-changelog