Forward audio inputs to the Responses API (#33932)

## Why

Audio variants were available in the user-input protocol but were replaced with unsupported-input placeholders instead of being sent to the model.

## What changed

- Serialize audio data URLs as `input_audio` content and convert local `wav`, `mp3`, `m4a`, `webm`, and `ogg` files to labeled data URLs.
- Validate and canonicalize base64 audio before requests, enforce the 50 MiB input limit, and replace invalid, unsupported, or oversized audio with explanatory text.
- Preserve audio attachments when mapping response items back to user-message events and document the app-server input variants.

## Testing

- Add unit coverage for local-file conversion, data URL validation, size and format errors, event mapping, and attachment extraction.
- Add client tests that verify data URL and local audio payloads sent to the Responses API.

GitOrigin-RevId: f72cd6b6e43ab12757eeb47621b1d670594ac7d9
This commit is contained in:
nhamidi-oai authored and copyberry committed 2026-07-18 00:26:24 +00:00
1 parent bcdc695877
commit 23899f7cb6
13 files changed
+802 -40

No files matched your search

@@ -548,7 +548,8 @@ fn create_collab_input_items_schema() -> JsonSchema {
(
"type".to_string(),
JsonSchema::string(Some(
"Input item type: text, image, local_image, skill, or mention.".to_string(),
"Input item type: text, image, local_image, audio, local_audio, skill, or mention."
.to_string(),
)),
),
(
@@ -561,7 +562,7 @@ fn create_collab_input_items_schema() -> JsonSchema {
),
(
"audio_url".to_string(),
JsonSchema::string(Some("Audio URL when type is audio.".to_string())),
JsonSchema::string(Some("Audio data URL when type is audio.".to_string())),
),
(
"path".to_string(),