From ac4946477b480e436ac97d4c9848734f325c9e04 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Tue, 15 Sep 2026 12:40:44 -0500 Subject: [PATCH] fix(transcription): type SDK stream duration metadata explicitly --- litellm/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/main.py b/litellm/main.py index 376645f55f4..3d3a0bb7ec6 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -7842,7 +7842,7 @@ async def atranscription( if file is not None: calculated_duration = calculate_request_duration(file) if calculated_duration is not None: - setattr(response, "_litellm_audio_duration", calculated_duration) + response._litellm_audio_duration = calculated_duration # pyright: ignore[reportAttributeAccess] # SDK streams permit runtime metadata but do not type this field return response if not isinstance(response, TranscriptionResponse): raise ValueError( @@ -8187,7 +8187,7 @@ def transcription( calculated_duration: Final = calculate_request_duration(file) if isinstance(response, (Stream, AsyncStream)): if calculated_duration is not None: - setattr(response, "_litellm_audio_duration", calculated_duration) + response._litellm_audio_duration = calculated_duration # pyright: ignore[reportAttributeAccess] # SDK streams permit runtime metadata but do not type this field elif getattr(response, "duration", None) is None and calculated_duration is not None: response.set_audio_transcription_duration(calculated_duration)