Skip to content

Conversation

@MengqinShen
Copy link
Contributor

@MengqinShen MengqinShen commented Jan 14, 2026

This PR is to add extra flows in google-genai sample to match that in JS SDK.

  1. The main change is to expanded GenAI sample flows: The google-genai-hello sample has been significantly expanded with numerous new flows demonstrating advanced capabilities of Google's Generative AI models, including multimodal interactions, image editing, video understanding, and various configuration options.
  2. Vertex AI Sample is also added to showcase Google GenAI functionalities specifically tailored for the Vertex AI platform, including video understanding with metadata and Google Maps grounding.
  3. Improvements have been made to how multimodal content within tool responses is processed and converted, allowing for the extraction of media parts (e.g., base64 encoded images) from tool outputs.
  4. The Google GenAI plugin now supports dynamic API versioning, allowing specific API versions (e.g., 'v1alpha') to be set via request configuration. Additionally, GeminiConfigSchema has been extended with new fields like thinking_config, file_search, and url_context.

MengqinShen-GL and others added 22 commits January 13, 2026 15:49
Co-authored-by: Mengqin Shen <mengqin@google.com>
feat(py/genkit): add define_partial for Handlebars partials

Expose define_partial in GenkitRegistry class for parity with JS SDK.
Allows programmatic registration of reusable template fragments.
# Conflicts:
#	py/packages/genkit/src/genkit/blocks/generate.py
#	py/samples/google-genai-hello/src/main.py
@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 introduces significant advancements to the Genkit framework, enhancing both its Go and Python ecosystems. The Go implementation gains a robust, experimental session management API and comprehensive documentation across its core packages, improving clarity and developer experience. Concurrently, the Python side expands its model integration with a new DeepSeek plugin and refines its development workflow by adopting ty check for type validation. Several existing samples have been updated to demonstrate these new capabilities, particularly highlighting advanced features of Gemini 3.0, ensuring users have up-to-date and practical examples.

Highlights

  • Go Session Management API: Introduced a new experimental session management API in Go (go/core/x/session/), complete with in-memory and Firestore-backed storage options, enabling stateful interactions across requests.
  • Comprehensive Go Documentation: Added extensive package-level documentation (doc.go files) for core Genkit Go packages (core, logger, tracing, genkit), providing clearer explanations and examples for developers.
  • Python DeepSeek Plugin: Integrated a new plugin for DeepSeek models (py/plugins/deepseek/), allowing Genkit Python applications to leverage DeepSeek's OpenAI-compatible API.
  • Python Type Checking Update: Migrated the Python linting setup from mypy to ty check for improved type analysis and consistency.
  • Enhanced Go Type System and JSON Handling: Refined Go type definitions with clearer comments, removed unused types, and improved JSON extraction from Markdown to handle more diverse formats.
  • Updated Google GenAI Python Samples: Numerous Python samples for Google GenAI have been updated to showcase advanced Gemini 3.0 features, including multipart tool calling, thinking levels, image editing, video generation, and various grounding capabilities.

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

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/python.yml
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 is a substantial pull request that introduces several new features and improvements across the Go, Python, and JavaScript SDKs. Key additions include expanded sample flows for Google GenAI, a new DeepSeek plugin for Python, and an experimental session management package for Go. The Go packages have also been significantly improved with extensive godoc documentation. The changes are well-structured and include corresponding tests and samples for the new functionalities.

I've identified a couple of areas for improvement. One is related to the logic for handling tool_choice in the OpenAI-compatible plugin, which might lead to unexpected behavior. The other is a minor limitation in a Go utility function for extracting JSON from markdown. Overall, this is a high-quality contribution.

var jsonMarkdownRegex = regexp.MustCompile("(?si)```json\\s*(.*?)```")

// plainMarkdownRegex matches fenced code blocks without any language identifier.
var plainMarkdownRegex = regexp.MustCompile("(?s)```\\s*\\n(.*?)```")
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 regex for plain markdown blocks, plainMarkdownRegex, requires a newline after the opening fence (```). This means it will not match a fenced code block where the content starts on the same line, such as ```{"foo": "bar"}```, which is valid markdown. This could lead to failures in extracting JSON from such formatted strings.

Comment on lines +143 to +147
if any(msg.role == Role.TOOL for msg in request.messages):
# After a tool response, stop forcing additional tool calls.
openai_config['tool_choice'] = 'none'
elif request.tool_choice:
openai_config['tool_choice'] = request.tool_choice
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 logic to force tool_choice to 'none' when a tool response is present in the message history is a good heuristic to prevent tool-calling loops. However, it overrides any user-specified tool_choice which might be unexpected. For example, if a user explicitly sets tool_choice: 'required', this logic will change it to 'none', preventing the model from calling a required tool.

Consider making this behavior conditional. For instance, only force tool_choice to 'none' if the original request.tool_choice is not set or is 'auto'. If it's 'required' or a specific tool definition, it might be better to respect the user's explicit instruction.

@MengqinShen MengqinShen deleted the elisa/fix(py)/update-genai-sample-flows branch January 14, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config docs Improvements or additions to documentation fix go js python Python

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants