Skip to content

Conversation

@MengqinShen
Copy link
Contributor

@MengqinShen MengqinShen commented Jan 22, 2026

No description provided.

@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 refactors and fixes issues within the Genkit Python samples, specifically addressing broken flows related to image generation and handling. It centralizes all image-related functionalities into a dedicated google-genai-image sample, cleans up the google-genai-hello sample, and improves the core genkit library's JSON serialization to correctly handle byte data. These changes enhance the robustness, organization, and clarity of the Genkit Python examples.

Highlights

  • Improved JSON Serialization for Bytes: A new default_serializer function has been introduced in genkit/codec.py to handle bytes objects by base64 encoding them during JSON serialization. This serializer is now used as a fallback in json.dumps, ensuring proper handling of binary data.
  • Enhanced Gemini Image Configuration Handling: The _genkit_to_googleai_cfg function in gemini.py now filters image_config keys to include only valid ones and removes the entire image_config if it's not supported by the installed Google AI SDK version. This prevents errors and improves compatibility for image generation requests.
  • Refactored Media Part Conversion for Gemini: The to_gemini function in utils.py has been updated to correctly differentiate and handle MediaPart objects based on their URL scheme. It now uses inline_data for base64 encoded data: URLs and file_data for other file URIs, fixing how media content is passed to the Gemini API.
  • Consolidated Image-Related Flows into Dedicated Sample: Several image generation and manipulation flows, including generate_images, multipart_tool_calling, gemini_image_editing, nano_banana_pro, photo_move_veo, gemini_media_resolution, and multimodal_input, have been moved from py/samples/google-genai-hello/src/main.py to py/samples/google-genai-image/src/main.py. This centralizes image-specific examples, making the hello sample more focused and the image sample more comprehensive.
  • Simplified google-genai-hello Sample: The google-genai-hello sample (py/samples/google-genai-hello/src/main.py) has been streamlined by removing image-related flows, their associated imports, and the thinking_level configuration. This makes the hello sample simpler and easier to understand for basic Genkit functionalities.

🧠 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 several fixes and refactorings. It correctly handles bytes serialization in codec.py and improves media URL handling in the Google GenAI plugin. It also refactors the sample applications by moving image-related flows to the google-genai-image sample.

My review has identified a few issues. Most critically, both sample applications (google-genai-hello and google-genai-image) contain hardcoded, user-specific paths in sys.path, which will break the samples for other developers and poses a security risk. I've also pointed out some opportunities for code cleanup, such as removing duplicate imports and unused variables, and improving performance and exception handling. Please address these points to improve the quality and robustness of the code.

@MengqinShen MengqinShen marked this pull request as ready for review January 22, 2026 22:25
@MengqinShen MengqinShen requested a review from yesudeep January 22, 2026 22:25
@yesudeep yesudeep enabled auto-merge (squash) January 22, 2026 22:41
@yesudeep yesudeep merged commit 67f8c0e into main Jan 22, 2026
22 checks passed
@yesudeep yesudeep deleted the elisa/fix(py)/update-genai-image-flows branch January 22, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants