Conversation
Summary of ChangesHello, 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 introduces a new Request for Comments (RFC) document that proposes adding an explicit 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. Changelog
Activity
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. 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces an RFC for adding a mode parameter to GenerateOptions to allow developers to explicitly choose between foreground and background model execution. The RFC is well-structured and clearly outlines the motivation, API changes, and implementation details for the TypeScript SDK. My feedback focuses on improving the RFC's clarity around error handling and considering the cross-language implications of this core change.
Note: Security Review has been skipped due to the limited scope of the PR.
| ## Internal Implementation Details | ||
|
|
||
| *This section details the architectural changes required under the hood to support the new `mode` parameter.* |
There was a problem hiding this comment.
This RFC provides a solid plan for the TypeScript implementation. Since GenerateOptions is a core concept in Genkit, it would be valuable for this RFC to briefly touch upon the implications for other supported languages like Go and Python.
Mentioning how this change would propagate to other SDKs would make the RFC more comprehensive. For example, would GenerateActionOptions in Go and Python also get the mode field? A short section or a note on cross-language consistency would be a great addition.
| The internal model lookup utilities (`resolveModel` and `lookupModel` in `js/ai/src/model.ts`) must be updated to respect the `mode` parameter: | ||
| - If `mode: 'foreground'` is passed, it strictly targets the `/model/{name}` registry path. | ||
| - If `mode: 'background'` is passed, it strictly targets the `/background-model/{name}` registry path. | ||
| - If `mode` is `undefined`, it maintains the legacy automatic fallback chain (try `/model/` first, then `/background-model/`). |
There was a problem hiding this comment.
The proposed resolution logic is clear. To further improve clarity, it would be beneficial to explicitly state the behavior when a user provides an explicit mode but no model supporting that mode is found. For example, if a user specifies mode: 'foreground' for a model that only has a background implementation.
I suggest adding a note about error handling, for instance:
If an explicit
modeis provided but no model supporting that mode is found under the given name, the resolution should fail with aNOT_FOUNDerror. This ensures the developer's explicit intent is respected and prevents accidentally falling back to a different execution mode.
Checklist (if applicable):