fix: capture DashScope multimodal media outputs#227
Conversation
265a89a to
8a17210
Compare
ralf0131
left a comment
There was a problem hiding this comment.
Summary
DashScope MultiModalConversation output parsing now captures image and video content items as Uri parts in gen_ai.output.messages, extending the existing text/audio handling to all media types returned by the API. The implementation correctly mirrors the input-side extraction pattern (text → image → audio → video) and the existing Uri construction used throughout the file.
Findings
No issues found. The new elif branches follow the established pattern exactly — same Uri(uri, modality, mime_type=None, type="uri") shape as the existing audio handling, consistent with both _extract_multimodal_input_messages and the image/video synthesis paths.
Test Coverage
- Parametrized unit test covers image, audio, and video URI extraction (audio was previously untested at this level — nice bonus).
- Mixed-content test (text + image) verifies part ordering is preserved.
- End-to-end span attribute test validates the full pipeline from response parsing through to
gen_ai.output.messageson the finished span.
Compatibility
Purely additive — new elif branches, no change to existing behavior or public API. Backward compatible.
Automated review by github-manager-bot
Description
This PR updates DashScope
MultiModalConversationoutput parsing so media URLs returned in response content are captured as output URI parts. Image and video content items now becomeUriparts ingen_ai.output.messages, matching the existing text/audio handling and allowing downstream multimodal processing to see generated media outputs.Fixes # (N/A)
Type of change
How Has This Been Tested?
git diff --checkpython -m pytest instrumentation-loongsuite/loongsuite-instrumentation-dashscope/tests/test_multimodal_conversation.py -qpython -m pytest instrumentation-loongsuite/loongsuite-instrumentation-dashscope/tests/test_image_synthesis.py -qpython -m ruff check instrumentation-loongsuite/loongsuite-instrumentation-dashscopepython "$PIPELINE_SKILL_DIR/scripts/check_loongsuite_pr_readiness.py" --repo .tox -e precommittox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-dashscope-oldest,py313-test-loongsuite-instrumentation-dashscope-latestValidation Evidence
Spec and Scope
MultiModalConversationimage output capture.response.output.choices[0].message.content = [{"image": "..."}].loongsuite-instrumentation-dashscopeoutput message extraction and tests.Local Checks
python "$PIPELINE_SKILL_DIR/scripts/check_loongsuite_pr_readiness.py" --repo .tox -e precommittox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-dashscope-oldest,py313-test-loongsuite-instrumentation-dashscope-latesttox -c tox-loongsuite.ini -e lint-loongsuite-instrumentation-dashscopepython -m ruff check instrumentation-loongsuite/loongsuite-instrumentation-dashscopepassed.Real E2E Matrix
MultiModalConversation.call(model="wan2.7-image")smokegen_ai.output.messageswithmodality=imageURI.tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-dashscope-oldest,py313-test-loongsuite-instrumentation-dashscope-latestTelemetry and Weaver
chat wan2.7-imageLLM span with image URI ingen_ai.output.messages.SPAN_ONLY; existing no-content tests in DashScope suiteweaver registry live-check -r <loongsuite-semantic-conventions-registry> --advice-profile loongsuite-genai ...CI
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.