mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-29 06:33:28 +00:00
fix(transcription): type SDK stream duration metadata explicitly
This commit is contained in:
parent
bd603fa44e
commit
d9f21872e2
1 changed files with 2 additions and 2 deletions
|
|
@ -8218,7 +8218,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(
|
||||
|
|
@ -8562,7 +8562,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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue