Skip to content

Conversation

@MengqinShen
Copy link
Contributor

Description here... Help the reviewer by:

  • linking to an issue that includes more details
  • if it's a new feature include samples of how to use the new feature
  • (optional if issue link is provided) if you fixed a bug include basic bug details

Checklist (if applicable):

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @MengqinShen, 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 modernizes the Google GenAI plugin by transitioning from static model definitions to dynamic discovery directly from the API. This change significantly improves the plugin's adaptability to new models and features, such as the newly integrated Veo text-to-video model. It streamlines how the plugin identifies and configures various AI capabilities, making it more robust and future-proof without requiring code updates for every new model release.

Highlights

  • Dynamic Model Discovery: The Google GenAI plugin now dynamically lists and resolves models (Gemini, Imagen, Embedders, Veo) by querying the Google GenAI API, replacing static model lists. This ensures the plugin always reflects the latest available models.
  • Veo Model Integration: A new VeoModel and VeoConfigSchema have been introduced to support text-to-video generation, including asynchronous polling for long-running operations.
  • Flexible Configuration Schemas: The GeminiConfigSchema has been refactored to use pydantic.BaseModel with extra='allow', enabling dynamic configuration parameters and including common generation settings. Helper functions were added to dynamically retrieve the correct schema based on model type.
  • Refactored Plugin Initialization and Action Listing: The init and list_actions methods in both GoogleAI and VertexAI plugins have been updated to leverage the new dynamic model discovery logic, providing more accurate and up-to-date action metadata.
  • Enhanced Test Coverage: Unit tests have been updated and expanded to validate the new dynamic model discovery, model resolution, and configuration schema handling, including specific tests for Veo and system prompt extraction.

🧠 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.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces dynamic model discovery for the Google GenAI plugin, which is a great improvement over hardcoded model lists. The changes are extensive and touch both the GoogleAI and VertexAI plugin implementations, as well as model definition files and tests.

My review has identified several critical indentation issues throughout google.py that will cause runtime errors. I've also found an opportunity to simplify the long-running operation handling in the new veo.py model implementation. Additionally, there are a few minor suggestions for code cleanup.

Once the critical indentation issues are resolved, this will be a solid contribution.

actions = []
# Gemini Models
for name in genai_models.gemini:
actions.append(self._resolve_model(googleai_name(name)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This line has incorrect indentation, which will cause an IndentationError. Please correct it to use standard 4-space indentation.

Suggested change
actions.append(self._resolve_model(googleai_name(name)))
actions.append(self._resolve_model(googleai_name(name)))

Comment on lines +56 to +59
gemini: list[str] = []
imagen: list[str] = []
embedders: list[str] = []
veo: list[str] = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The class attributes gemini, imagen, embedders, and veo are mutable lists initialized at the class level. This is generally discouraged as they are shared across all instances of the class. Although the __init__ method correctly creates instance-specific attributes, the class-level attributes are redundant and can be misleading. It's better to declare the types at the class level without initializing them, and perform initialization only in __init__.

Suggested change
gemini: list[str] = []
imagen: list[str] = []
embedders: list[str] = []
veo: list[str] = []
gemini: list[str]
imagen: list[str]
embedders: list[str]
veo: list[str]

Comment on lines 18 to 22
from typing import Any

from google import genai
from google.genai import types as genai_types
from pydantic import ValidationError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The imports Any (line 18) and ValidationError (line 22) are unused in this file. It's good practice to remove unused imports to keep the code clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants