Fix/artifact dict handling 3495 simplified#4523
Fix/artifact dict handling 3495 simplified#4523Fangmbeng wants to merge 3 commits intogoogle:mainfrom
Conversation
…remove redundant conversion from ForwardingArtifactService
Summary of ChangesHello @Fangmbeng, 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 significantly improves the usability of artifact saving by allowing developers to directly pass dictionary-shaped data, which is then automatically converted into the expected 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. Changelog
Activity
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
|
|
Response from ADK Triaging Agent Hello @Fangmbeng, thank you for your contribution! To help us review this PR, could you please fill out the pull request description? Specifically, it would be helpful to:
You can find more details in our contribution guide. This information will help reviewers to understand and verify your changes more efficiently. Thanks! |
There was a problem hiding this comment.
Code Review
This pull request simplifies artifact handling by allowing dictionary-shaped artifacts to be passed to save_artifact methods. The changes are consistently applied across different artifact service implementations, and new tests are added to cover this functionality. My review includes one high-severity finding regarding a bug where custom_metadata is not forwarded correctly in one of the services, and a couple of medium-severity suggestions to enhance the new tests by including custom_metadata in the test cases. Overall, this is a good improvement.
| # Delegate to parent tool context, which will handle conversion in the | ||
| # concrete artifact service implementation. |
There was a problem hiding this comment.
This delegation is missing the custom_metadata parameter in the call to self.tool_context.save_artifact. This will cause any provided custom_metadata to be silently ignored. Please forward it to the underlying call.
For example:
return await self.tool_context.save_artifact(
filename=filename,
artifact=artifact,
custom_metadata=custom_metadata,
)| user_id=user_id, | ||
| session_id=session_id, | ||
| filename=filename, | ||
| artifact=dict_artifact, |
There was a problem hiding this comment.
The new tests for dict-shaped artifacts are great! To make them even more robust, consider also testing the custom_metadata parameter. This would ensure that metadata is correctly handled when saving dictionary-shaped artifacts.
You would also need to add assertions to verify that the custom_metadata is saved and loaded correctly, for example by using get_artifact_version.
artifact=dict_artifact,
custom_metadata={"source": "dict-test"}| user_id=user_id, | ||
| session_id=session_id, | ||
| filename=filename, | ||
| artifact=dict_artifact, |
There was a problem hiding this comment.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
If applicable, please follow the issue templates to provide as much detail as
possible.
Problem:
A clear and concise description of what the problem is.
Solution:
A clear and concise description of what you want to happen and why you choose
this solution.
Testing Plan
Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.
Unit Tests:
Please include a summary of passed
pytestresults.Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.
Checklist
Additional context
Add any other context or screenshots about the feature request here.