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

Abierto
#9,170 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Kiko0301 ya está trabajando en esto.

Desde el 6/11/2026.

  • #9175 de @Kiko0301 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
ai, backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
60.6k
Forks
9.1k
Merge medio
1 d 2 h
PR fusionados (30 d)
214

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de crewAIInc/crewAI

Todos los issues de crewAIInc/crewAI

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.