Skip to content

Conversation

@MengqinShen
Copy link
Contributor

@MengqinShen MengqinShen commented Jan 6, 2026

CHANGELOG:

  • Added 'Resource' action kind
  • Added a define_resource method to the Genkit class
  • Created a resource management module - genkit/blocks/resource.py
  • Added test files test_resource.py and resource_test.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 a fundamental new capability to the Genkit Python SDK: the concept of 'resources'. These resources represent addressable content or data processing units, identified by URIs, and can be either static or dynamically resolved using URI templates. The changes provide a robust mechanism for defining, registering, and retrieving various forms of unstructured data within the Genkit framework, enhancing its ability to integrate and manage diverse data sources.

Highlights

  • New 'Resource' Action Kind: Introduced a new RESOURCE type within the ActionKind enum, enabling the Genkit framework to define and manage addressable content or data processing units.
  • Resource Definition API: Added a define_resource method to the Genkit class, allowing users to register resources with the framework. This method takes options (like URI or template) and a function to implement resource content retrieval.
  • Resource Management Module: A new module, genkit/blocks/resource.py, has been created. It provides core functionalities for defining, matching, and resolving resources, including support for URI templates (e.g., file://{path}) and handling metadata for resource content parts.
  • Flexible Action Registration: The Registry class now includes a register_action_from_instance method, which allows pre-configured Action objects (like those created by dynamic_resource) to be registered, enhancing flexibility in how actions are managed.
  • Comprehensive Testing: New test files (test_resource.py and resource_test.py) have been added to thoroughly validate the new resource definition, resolution, and matching logic, including static, template-based, and dynamic resource scenarios.

🧠 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 a new resource action type to Genkit, providing a way to define and manage addressable content. The changes include adding the resource kind, implementing the core logic for defining and looking up resources in a new resource.py module, and adding corresponding tests. The implementation is solid, but I have a few suggestions to improve code clarity, maintainability, and testing practices. My feedback includes removing commented-out code, improving type hints, preserving original stack traces in exceptions, avoiding access to private members, and simplifying the test setup.

@MengqinShen MengqinShen marked this pull request as ready for review January 6, 2026 20:52
@MengqinShen MengqinShen requested a review from yesudeep January 6, 2026 20:52
@MengqinShen MengqinShen merged commit c9545c8 into main Jan 6, 2026
10 checks passed
@MengqinShen MengqinShen deleted the elisa/feat(py)/add-define-resource-pr-3993 branch January 6, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants