mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(transcription): type SDK stream duration metadata explicitly
This commit is contained in:
parent
bd43c233ef
commit
ac4946477b
1 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue