Skip to content

Vendor lm15 with ogg, opus, flac, aac, aiff, webm and mpeg input_audio - #10532

Draft
jonasherfort wants to merge 6 commits into
stanfordnlp:mainfrom
jonasherfort:chore/vendor-lm15-audio-formats
Draft

jonasherfort wants to merge 6 commits into
stanfordnlp:mainfrom
jonasherfort:chore/vendor-lm15-audio-formats

Conversation

@jonasherfort

Copy link
Copy Markdown

dspy.Audio renders as a Chat Completions input_audio block whose format is the file's MIME subtype. The vendored lm15 reads that body into a canonical request before it chooses a provider. That reader accepted only wav and mp3, so an ogg/opus recording sent to a Gemini model never reached lm15's Gemini request. On the lm15 engine it raised input_audio.format must be one of ['mp3', 'wav']; otherwise DSPy fell back to LiteLLM. An .mp3 file, which DSPy labels mpeg, hit the same wall.

This updates the vendored lm15 with scripts/update_vendored_lm15.py to cmpnd-ai/lm15-python b0bffc1 (cmpnd-ai/lm15-python#2), the one-line-table fix on the 1.0.0rc3 line. Each format now reads as its true media type: ogg, opus, flac, aac, aiff, webm and mpeg join wav and mp3. Gemini sends the part as inlineData with that type. The OpenAI Chat Completions and Anthropic builders still refuse audio before the wire. The vendored diff is that table and the provenance record.

tests/clients/test_lm15_audio_formats.py runs dspy.Predict with an ogg dspy.Audio through a fake transport and checks the Gemini inlineData part. It fails on the previous vendor and passes now. The full suite passes (2314 passed, 519 skipped, 2 xfailed), and ruff check is clean.

Draft until cmpnd-ai/lm15-python#2 lands; if it lands under another SHA, the updater is re-run against it. The format list itself is lm15-dev/lm15-contract#1.

git-subtree-dir: dspy/_vendor/lm15
git-subtree-split: 63b6bb319f38ad1d31060138da54cb8ac8718711
6a745c84e fix(openai-chat): read ogg, opus, flac, aac, aiff, webm and mpeg input_audio as their true media types

git-subtree-dir: dspy/_vendor/lm15
git-subtree-split: 6a745c84e83a58aa4ed1237132d940f78ce65c35
git-subtree-dir: dspy/_vendor/lm15
git-subtree-mainline: 9c900c7
git-subtree-split: 63b6bb319f38ad1d31060138da54cb8ac8718711
Source: https://github.com/cmpnd-ai/lm15-python.git
Python commit: b0bffc13bc4a12e115e4c2e92fbba40ca8f3450c
Contract: b721ce4f03877d72a91431b3a5ce653ffc0b3e38
Package split: 6a745c84e83a58aa4ed1237132d940f78ce65c35
Before the lm15 update, lm15's Chat Completions ingest refused every
input_audio format but wav and mp3, so an ogg recording never reached the
native Gemini request (DSPy fell back to LiteLLM, or raised on the lm15
engine). The test drives dspy.Predict through a fake transport and checks
the inlineData part.

This branch has not been deployed

No deployments
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