(Openinference Migration: Langchain): Capture multimodal image content (OpenAI image_url and Anthropic image blocks) as Blob/Uri message parts. - #296
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-08-04 22:32 UTC Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):
Status above doesn't look right?
|
There was a problem hiding this comment.
Pull request overview
Adds multimodal image support to the LangChain GenAI instrumentation by converting OpenAI image_url and Anthropic image blocks into Blob / Uri message parts, and extends the unit test suite to validate the new parsing behavior.
Changes:
- Add multimodal image parsing helpers (
_media_part,_image_from_url) to convert LangChain image blocks intoBlob/Uriparts. - Extend callback-handler tests to cover OpenAI and Anthropic image content shapes (including data URIs and base64 sources).
- Add a changelog fragment documenting the new capability.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/utils.py | Adds image block parsing and base64 decoding to emit Blob/Uri message parts. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/tests/test_callback_handler.py | Adds unit tests for data-URI, HTTP-URI, and Anthropic image/source parsing into message parts. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/.changelog/296.added | Documents the new multimodal image capture support. |
aa26c4f to
ed3949d
Compare
d72b64e to
501725d
Compare
|
@rads-1996 One thing I wanted to check on ordering. In That means a config that doesn't record content still copies large images. If that isn't intended, either skip the media decode when capture is off, or add a test asserting If the parse is meant to run unconditionally so the completion hook has something to work with, that's fine, I just wanted to confirm that's the assumption. |
@AgentGymLeader Thanks for the callout. I have gated decoding and will skipped when the content capture mode is |
9cd26fe to
1b98bc4
Compare
aaea6b5 to
d9fe119
Compare
…mage` blocks) as `Blob`/`Uri` message parts.
d9fe119 to
a61da13
Compare
Description
Part of the langchain migration PRs - #272
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. List any relevant details for your test
configuration.
Checklist
See CONTRIBUTING.md
for the style guide, changelog guidance, and more.