Skip to content

fix(py/genkit): ty check fixes for genkit.ai#4249

Merged
yesudeep merged 1 commit intomainfrom
yesudeep/fix/homeless-cat
Jan 24, 2026
Merged

fix(py/genkit): ty check fixes for genkit.ai#4249
yesudeep merged 1 commit intomainfrom
yesudeep/fix/homeless-cat

Conversation

@yesudeep
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yesudeep, 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 primarily focuses on enhancing the type checking and type hint accuracy within the genkit.ai Python package. The changes aim to improve static analysis, code clarity, and maintainability by refining parameter and return type annotations, ensuring correct asyncio usage, and explicitly casting enum values where necessary. These updates contribute to a more robust and predictable codebase.

Highlights

  • Type Hint Refinements: Updated various type hints across the genkit.ai package, including making the tool_choice parameter explicitly optional and clarifying config_schema to accept type[BaseModel] instead of BaseModel instances.
  • Asyncio Integration: Modified Future imports and usage to explicitly reference asyncio.Future and wrapped coroutines with asyncio.create_task for better asynchronous operation management.
  • Explicit Type Casting for ActionKind: Introduced explicit cast(ActionKind, ...) for ActionKind enum members in resolve_action and register_action calls to improve type checking accuracy.
  • Registry Access Correction: Corrected the access path for the internal registry within _make_reflection_server to registry.registry.
  • Method Return Type Consistency: Adjusted the return type hints for several registry methods like flow, tool, define_retriever, define_indexer, and define_batch_evaluator to consistently return Action.

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

@yesudeep yesudeep force-pushed the yesudeep/fix/homeless-cat branch from 74c85b5 to 9d6e6c9 Compare January 24, 2026 00:46
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 to improve type checking across the genkit python package. The changes include correcting type hints for optional arguments, using fully qualified names for asyncio types, and ensuring coroutines are correctly handled as Future objects. Additionally, many define_* methods have had their return types corrected to Action, and config_schema parameters are now correctly typed as type[BaseModel]. Overall, these are good improvements for code quality and maintainability. I've noted a couple of places where the updated return type hints for decorator factories seem incorrect, as they return a Callable but are now typed to return an Action.

@yesudeep yesudeep force-pushed the yesudeep/fix/homeless-cat branch from 9d6e6c9 to 66bc117 Compare January 24, 2026 00:50
@yesudeep yesudeep disabled auto-merge January 24, 2026 00:50
@yesudeep yesudeep force-pushed the yesudeep/fix/homeless-cat branch from 66bc117 to 3b1d556 Compare January 24, 2026 01:02
@yesudeep
Copy link
Contributor Author

/gemini review

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 series of fixes to improve type checking and overall code quality. The changes include correcting type hints for optional parameters, making asynchronous function signatures more explicit, and improving the robustness of function name retrieval. You've also added necessary checks for None values in several methods, which is great for preventing runtime errors. I've found one place where a similar check is missing, which I've detailed in a specific comment. Overall, these are solid improvements that enhance the reliability of the codebase.

@yesudeep yesudeep force-pushed the yesudeep/fix/homeless-cat branch 2 times, most recently from 7d9b501 to d68ae2b Compare January 24, 2026 01:07
@yesudeep
Copy link
Contributor Author

/gemini review

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 aims to fix several type checking issues. While many of the type hint corrections are valid, there's a recurring critical issue introduced across multiple files. The changes that replace snake_case attribute names with their camelCase aliases (e.g., eval_run_id to evalRunId) when instantiating Pydantic models will cause TypeError exceptions at runtime. Pydantic model constructors expect keyword arguments to match the Python attribute names, not their serialization aliases. I've left specific comments with suggestions to revert these particular changes. Other changes, such as improving type hints and adding None checks, are good improvements.

@yesudeep yesudeep force-pushed the yesudeep/fix/homeless-cat branch from d68ae2b to 0d9738b Compare January 24, 2026 01:13
@yesudeep yesudeep enabled auto-merge (squash) January 24, 2026 01:17
@yesudeep yesudeep disabled auto-merge January 24, 2026 01:18
@yesudeep yesudeep force-pushed the yesudeep/fix/homeless-cat branch from 0d9738b to 1b9046b Compare January 24, 2026 01:20
@yesudeep yesudeep enabled auto-merge (squash) January 24, 2026 01:20
@yesudeep yesudeep merged commit 2843587 into main Jan 24, 2026
22 checks passed
@yesudeep yesudeep deleted the yesudeep/fix/homeless-cat branch January 24, 2026 01:32
This was referenced Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants