mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(azure/audio_transcriptions.py): support azure cost tracking
extract content time and log correctly as duration
This commit is contained in:
parent
92d85555fe
commit
b8d590da0c
5 changed files with 18 additions and 21 deletions
|
@ -7,7 +7,11 @@ from pydantic import BaseModel
|
|||
import litellm
|
||||
from litellm.litellm_core_utils.audio_utils.utils import get_audio_file_name
|
||||
from litellm.types.utils import FileTypes
|
||||
from litellm.utils import TranscriptionResponse, convert_to_model_response_object
|
||||
from litellm.utils import (
|
||||
TranscriptionResponse,
|
||||
convert_to_model_response_object,
|
||||
extract_duration_from_srt_or_vtt,
|
||||
)
|
||||
|
||||
from .azure import (
|
||||
AzureChatCompletion,
|
||||
|
@ -156,6 +160,8 @@ class AzureAudioTranscription(AzureChatCompletion):
|
|||
stringified_response = response.model_dump()
|
||||
else:
|
||||
stringified_response = TranscriptionResponse(text=response).model_dump()
|
||||
duration = extract_duration_from_srt_or_vtt(response)
|
||||
stringified_response["duration"] = duration
|
||||
|
||||
## LOGGING
|
||||
logging_obj.post_call(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue