fix(py/genkit): ty check fixes for genkit.ai#4249
Conversation
Summary of ChangesHello @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 Highlights
🧠 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 AssistThe 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
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 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
|
74c85b5 to
9d6e6c9
Compare
There was a problem hiding this comment.
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.
9d6e6c9 to
66bc117
Compare
66bc117 to
3b1d556
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
7d9b501 to
d68ae2b
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
d68ae2b to
0d9738b
Compare
0d9738b to
1b9046b
Compare
No description provided.