Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

medical_imaging: fix error of google.genai.types.Part.from_bytes() a… #2228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Prabesh1sharma
Copy link

@Prabesh1sharma Prabesh1sharma commented Feb 25, 2025

…rgument after ** must be a mapping, not PngImageFile

Description

  • Summary of changes: The error occurs because the agent expects image input as a dictionary (i.e., a mapping with keys like "content" and "mime_type") rather than a PngImageFile object. When passing an AgnoImage created from a file path, it ultimately provides a PIL image instance to a function (e.g., Part.from_bytes(**image)) that expects a mapping.
    To fix this, the image is now read in binary mode and passed as a dictionary containing the image bytes and its MIME type.
  • Related issues: fix this issues.
  • Motivation and context:This update ensures compatibility with the expected input format, preventing errors when processing images.
  • Environment or dependencies:No new dependencies introduced
  • Impact on metrics: No performance degradation

Fixes # (issue):
I just cloned it and while running i get that error as
Detailed error: google.genai.types.Part.from_bytes() argument after ** must be a mapping, not PngImageFile
and i used this approach for solving that error and make pull request to fix it.


Type of change

Please check the options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Model update (Addition or modification of models)
  • Other (please describe):

Checklist

  • Adherence to standards: Code complies with Agno’s style guidelines and best practices.
  • Formatting and validation: You have run ./scripts/format.sh and ./scripts/validate.sh to ensure code is formatted and linted.
  • Self-review completed: A thorough review has been performed by the contributor(s).
  • Documentation: Docstrings and comments have been added or updated for any complex logic.
  • Examples and guides: Relevant cookbook examples have been included or updated (if applicable).
  • Tested in a clean environment: Changes have been tested in a clean environment to confirm expected behavior.
  • Tests (optional): Tests have been added or updated to cover any new or changed functionality.

Additional Notes

Include any deployment notes, performance implications, security considerations, or other relevant information (e.g., screenshots or logs if applicable).

…gument after ** must be a mapping, not PngImageFile
@Prabesh1sharma Prabesh1sharma requested a review from a team as a code owner February 25, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant