Skip to content

fix(openai-chat): read ogg, opus, flac, aac, aiff, webm and mpeg input_audio as their true media types - #2

Open
jonasherfort wants to merge 1 commit into
cmpnd-ai:mainfrom
jonasherfort:fix/ingest-more-audio-formats-cmpnd
Open

jonasherfort wants to merge 1 commit into
cmpnd-ai:mainfrom
jonasherfort:fix/ingest-more-audio-formats-cmpnd

Conversation

@jonasherfort

Copy link
Copy Markdown

request_from_openai_chat accepts an input_audio block only when its format is wav or mp3. Any other format raises ValueError: messages[1].content[1].input_audio.format must be one of ['mp3', 'wav'] at ingest, before a provider is chosen. DSPy renders dspy.Audio as input_audio with the file's MIME subtype as the format, so an ogg/opus phone recording sent to vertex:gemini-3.8-flash fails even though Gemini takes audio/ogg natively. An .mp3 file fails too, because DSPy labels it mpeg. wav | mp3 is the list for OpenAI's own server. Google's Chat Completions server accepts every audio MIME type, and MAP-12 rule 4 already says ingest is not where a wire gap is hidden.

Each format now reads as its true media type: wav as audio/wav, mp3 and mpeg as audio/mpeg, and ogg, opus, flac, aac, aiff and webm as audio/<format>. No format is relabelled as another type. An unknown format is still malformed. Nothing changes at send time. Gemini sends the part as inlineData with its media type. The Chat Completions and Anthropic builders still refuse audio before the wire (MAP-10). m4a/mp4 is left out because no receipt shows which spelling Gemini accepts.

This is the same table fix as lm15-dev#16, on the 1.0.0rc3 line (55fce2e) that DSPy vendors, so DSPy can re-vendor it without taking 1.1.0. The contract amendment is lm15-dev/lm15-contract#1. New tests in tests/test_openai_chat_ingest.py cover the media type for each format, the ingest-to-Gemini inlineData path, the Chat Completions refusal of the same request and an unknown format; they fail before the fix and pass now. The full suite passes (3333 passed).

…t_audio as their true media types

request_from_openai_chat refused every input_audio format but wav and mp3,
before any provider was chosen, so a DSPy ogg/opus recording bound for Gemini
failed at ingest although Gemini takes audio/ogg natively. Each format now
reads as its true media type; an unknown format is still malformed, and the
Chat Completions and Anthropic builders still refuse audio at send (MAP-10).

The same change as the lm15-dev/lm15-python fix, on the line DSPy vendors;
CONTRACT_PIN stays at b721ce4, whose MAP-12 rule 4 still lists wav and mp3.

Signed-off-by: Jonas Dreyøe Herfort <jdreyoe@gmail.com>
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