- 
                Notifications
    You must be signed in to change notification settings 
- Fork 148
feat: google-genai support image url pdf types #2341
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
base: main
Are you sure you want to change the base?
Conversation
|  | ||
| def _flatten_parts(self, parts: list[Part]) -> Iterator[Tuple[str, AttributeValue]]: | ||
| content_values = [] | ||
| tool_call_index = 0 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will
 yield (
                    f"{MessageContentAttributes.MESSAGE_CONTENT_IMAGE}.{ImageAttributes.IMAGE_URL}",
                    data_url,
                )
get ignored or inadvertently converted into a singular message_content  in _flatten_parts? Seems like we only check for certain attributes, otherwise we flatten into a single message.  Don't we want to preserve this image_url attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yess thanks for bringing this up, I have reviewed and updated the pr so that the attributes are exported and rendered correctly on phoenix as shown in latest screenshot above in description
| Bug: Image Overwrite Due to Missing IndexingMultiple image parts within a single message overwrite each other in the trace attributes. This happens because the generated OpenInference attributes for images lack indexing, causing all images to use the same key and only the last image's data to be preserved. | 
| logger.debug(f"Non-text part encountered: {part}") | ||
| else: | ||
| # TODO: Handle other types of parts | ||
| logger.debug(f"Non-text part encountered: {part}") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incorrect Indentation Causes Debug Log Misplacement
The else clause is incorrectly indented, associating it with the inner for loop instead of the if/elif chain. This causes the debug log "Non-text part encountered" to print after processing all attributes for each part, even when they're handled correctly. This else clause is also redundant, as unsupported part types are now handled in _get_attributes_from_part.
resolves #2194

Note
Adds proper handling of
Part.inline_dataandPart.file_data(images/files) with image semconv, Phoenix-friendly input serialization, plus new tests, example, and test dependency updates.Part.inline_dataandPart.file_data:message.content.image.image_urlwith data URLs or file URIs using OpenInference image semantics.[File: mime, size/uri]inmessage.content._as_input_attributes.examples/generate_content_with_images.pydemonstrating inline/URI images, PDFs, and async usage.inline_data/file_datahandling and ensure existing text/function parts remain unchanged.opentelemetry-sdk>=1.38.0,opentelemetry-exporter-otlp>=1.38.0.Written by Cursor Bugbot for commit fd65407. This will update automatically on new commits. Configure here.