fix: silence GenAI audio optional dependency import warning#223
Merged
Conversation
123liuziming
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #217.
This removes the import-time warning from
opentelemetry.util.genai._multimodal_upload.pre_uploaderwhen optional audio conversion dependencies (numpyorsoundfile) are not installed. The PCM16-to-WAV conversion path still logs a single warning when conversion is actually attempted and cannot be performed.The change is intentionally scoped to
loongsuite-otel-util-genai.loongsuite-site-bootstrapis out of scope because its stdout success line already has theLOONGSUITE_PYTHON_SITE_BOOTSTRAP_LOG_SUCCESS=Falsemitigation in the released package.Type of change
How Has This Been Tested?
python -m ruff check util/opentelemetry-util-genai/src/opentelemetry/util/genai/_multimodal_upload/pre_uploader.py util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py util/opentelemetry-util-genai/CHANGELOG.mdPYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py -qPYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests -qqwen3-maxreal API smoke comparing release util against this PR util overlay; release emitted the reported warning, PR overlay did not.tox -e precommitDoes This PR Require a Core Repo Change?
Checklist:
Validation Evidence
Spec and Scope
loongsuite-site-bootstrapexplicitly excluded from this PR because the released 0.6.1 package already supportsLOONGSUITE_PYTHON_SITE_BOOTSTRAP_LOG_SUCCESS=False.loongsuite-otel-util-genaimultimodal pre-uploader optional audio dependency handling.Local Checks
python "$PIPELINE_SKILL_DIR/scripts/check_loongsuite_pr_readiness.py" --repo .tox -e precommitPYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py -qPYTHONPATH=util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest util/opentelemetry-util-genai/tests -qLOONGSUITE_PYTHON_SITE_BOOTSTRAP=False PYTHONPATH=instrumentation-loongsuite/loongsuite-instrumentation-qwenpaw/src:util/opentelemetry-util-genai/src:opentelemetry-instrumentation/src python -m pytest instrumentation-loongsuite/loongsuite-instrumentation-qwenpaw/tests util/opentelemetry-util-genai/tests/_multimodal_upload/test_pre_uploader_audio.py -qclaude_team_review.py review . --backend review ...git diff | rg -n "sk-[A-Za-z0-9]|DASHSCOPE_API_KEY|OPENAI_API_KEY|ANTHROPIC_API_KEY|Bearer [A-Za-z0-9]|/Users/sipercai|/tmp/codex-claude-review|private trace|trace_id|traceId" || trueReal E2E Matrix
qwen3-maxAgentRunner.query_handlersmoke with release util and PR util overlay.numpy or soundfile not available...; PR util overlay removed that line. Both runs completed withreal_api_chunks=5 last=True.test_pcm16_conversion_missing_audio_libs_logs_single_warningaudio/pcm16content type.Telemetry and Weaver
CI