diff --git a/tests/unit/litellm_core_utils/audio_utils/test_transcription_streaming.py b/tests/unit/litellm_core_utils/audio_utils/test_transcription_streaming.py index 5296ea3b15a..5b0e061d3f5 100644 --- a/tests/unit/litellm_core_utils/audio_utils/test_transcription_streaming.py +++ b/tests/unit/litellm_core_utils/audio_utils/test_transcription_streaming.py @@ -19,6 +19,7 @@ from litellm.litellm_core_utils.audio_utils.transcription_streaming import ( litellm_exception_mapper, wrap_transcription_stream, ) +from litellm.llms.custom_httpx.transport_errors import TransportErrorKind, chained_transport_error_kind from litellm.types.utils import TranscriptionResponse _STARTED_AT: Final = datetime.datetime(2026, 10, 28, 12, 0, 0) # noqa: DTZ001 # callback timestamps use the legacy naive contract @@ -177,10 +178,12 @@ async def test_a_stream_the_upstream_drops_mid_transcript_raises_a_litellm_error model="openai/gpt-transcribe", file=("sample.wav", b"audio"), stream=True, client=upstream ) - with pytest.raises(litellm.APIConnectionError, match="peer closed connection"): + with pytest.raises(litellm.APIConnectionError) as raised: async for _ in stream: pass + assert chained_transport_error_kind(raised.value) is TransportErrorKind.DROPPED_CONNECTION + class _FailureHookCounter(CustomLogger): def __init__(self) -> None: diff --git a/tests/unit/proxy/proxy_server/test_routes_audio.py b/tests/unit/proxy/proxy_server/test_routes_audio.py index 9fa617c0dc3..4f25546f1bd 100644 --- a/tests/unit/proxy/proxy_server/test_routes_audio.py +++ b/tests/unit/proxy/proxy_server/test_routes_audio.py @@ -1037,7 +1037,7 @@ def test_streamed_transcription_error_mid_stream_ends_with_an_error_event_and_ru assert tuple(frame.get("delta") for frame in frames[:2]) == ("hello ", "world") assert len(frames) == 3 assert data_lines[-1] == "[DONE]" - assert "upstream connection dropped" in frames[2]["error"]["message"] + assert "APIConnectionError" in frames[2]["error"]["message"] assert "/srv/app/stt_stream.py" not in frames[2]["error"]["message"] assert "stt.internal.corp" not in frames[2]["error"]["message"] assert set(frames[2]["error"]) == {"message", "type", "param", "code"}