[BUG] OpenAI Responses requests crash on audio inputs advertised by provider constraints

Aperta
#9,170 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Kiko0301 ci sta già lavorando.

Dal 6/11/2026.

  • #9175 di @Kiko0301 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
ai, backend

Direzione di ricerca

Read lib/crewai-files/src/crewai_files/processing/constraints.py around OPENAI_RESPONSES_CONSTRAINTS and lib/crewai-files/src/crewai_files/formatting/openai.py around OpenAIResponsesFormatter.format_block. Run the named tests in lib/crewai-files/tests/test_openai_responses_files.py to reproduce the failure and confirm the expected behavior. Done means Responses no longer advertises audio support and formatting an audio input returns an empty list; linked pull request #9175 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

OPENAI_RESPONSES_CONSTRAINTS advertises audio support, so an audio file attached to a task is auto-injected into the OpenAI Responses request instead of being handled by the file tools. The Responses formatter, however, only knows how to emit image and PDF blocks, so formatting the file raises:

TypeError: Unsupported content type for Responses API: audio/mpeg

lib/crewai-files/src/crewai_files/processing/constraints.py:241:

OPENAI_RESPONSES_CONSTRAINTS = ProviderConstraints(
    name="openai_responses",
    ...
    audio=AudioConstraints(
        max_size_bytes=26_214_400,  # 25 MB - whisper limit
        max_duration_seconds=1500,  # 25 minutes, arbitrary-ish, this is from the transcriptions limit
    ),
    ...
)

The comment points at the transcription endpoint, not the Responses file-input API, and OpenAIResponsesFormatter.format_block (lib/crewai-files/src/crewai_files/formatting/openai.py:38) only handles input_image and input_file; every other content type falls through to TypeError at line 97.

get_supported_content_types("openai", api="responses") therefore returns ['image/', 'application/pdf', 'audio/'], which drives both the task auto-injection decision (lib/crewai/src/crewai/task.py:1041, lib/crewai/src/crewai/crew.py:1718) and the formatter dispatch. An audio attachment that should have gone to the tool fallback is instead sent down a path that cannot format it.

Reproduction

from unittest.mock import patch

from crewai_files import AudioFile, format_multimodal_content
from crewai_files.core.sources import FileBytes

with patch(
    "crewai_files.core.sources.detect_content_type", return_value="audio/mpeg"
):
    audio = AudioFile(
        source=FileBytes(data=b"ID3\x04\x00\x00\x00\x00\x00\x00payload", filename="clip.mp3")
    )

format_multimodal_content({"clip": audio}, "openai", api="responses")
# TypeError: Unsupported content type for Responses API: audio/mpeg

Expected behaviour

Audio is not a supported Responses file input in this code path, so it should not be advertised as one. The audio file should be filtered out of the multimodal blocks (and handled by the file tool fallback) exactly like other unsupported types, instead of aborting the whole request.

Suggested fix

Remove the audio=AudioConstraints(...) entry from OPENAI_RESPONSES_CONSTRAINTS (the typo-shaped limits came from the transcription endpoint). The provider then advertises only the types its formatter implements; no formatter change is needed.

Tests

lib/crewai-files/tests/test_openai_responses_files.py adds:

  • test_responses_does_not_advertise_audio_support asserts "audio/" is absent from get_supported_content_types("openai", api="responses").
  • test_audio_input_is_skipped_instead_of_raising formats an MP3 and asserts the result is [] rather than an exception.

Both pass with the fix. On main they fail with the assertion above and with TypeError: Unsupported content type for Responses API: audio/mpeg.

Prepared with an AI coding agent. Please apply the llm-generated label; this account cannot set repository labels.

Lingua principale
Python
Stelle
60.6k
Fork
9.1k
Merge medio
1g 4h
PR unite (30g)
214

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di crewAIInc/crewAI

Tutte le issue di crewAIInc/crewAI

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.