refactor(go/plugins/googlegenai): update plugin structure#4414
refactor(go/plugins/googlegenai): update plugin structure#4414
Conversation
Summary of ChangesHello @apascal07, 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 substantial internal refactoring of the Google GenAI plugin. The primary goal is to enhance code organization, maintainability, and consistency in how AI models, embedders, and their associated actions are managed. By centralizing model classification, action resolution, and specific utility functions into new, dedicated files, the changes aim to simplify future development and reduce complexity within the plugin's core logic. 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
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 significant refactoring and new functionality to the googlegenai plugin. Key changes include the creation of new files (actions.go, code_execution.go, embedder.go, model_type.go, refs.go, schema.go, tools.go) to better organize code related to actions, code execution, embedders, model classification, model references, JSON schema translation, and tool handling. The gemini.go file was heavily refactored, with many functions and types moved to these new files, and its newModel function updated to use a new ClassifyModel utility for determining model types and their default configurations. The googlegenai.go file was simplified by removing model and embedder option defaults, and ModelRef functions, which were moved to models.go and refs.go respectively. The models.go file now centralizes model capability definitions (BasicText, Multimodal, Media, VeoSupports) and default options, and introduces GetModelOptions and GetEmbedderOptions for consistent option retrieval. The listGenaiModels function in models.go was updated to use the new ClassifyModel for categorizing models. The googleai_live_test.go was updated to reflect the new way of referencing embedders by name. Review comments suggested improving the ClassifyModel logic to prioritize more specific model name prefixes to prevent misclassification, and refactoring the listActions function to reduce code duplication when iterating over Gemini and Imagen models. Additionally, a log.Fatal call in listGenaiModels was flagged as inappropriate for a library function and a suggestion was made to return an error instead.
No description provided.