mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix(whisper---handle-openai/azure-vtt-response-format): Fixes https://github.com/BerriAI/litellm/issues/4595
This commit is contained in:
parent
53cbfa7a7a
commit
d68ab2a8bc
10 changed files with 252 additions and 84 deletions
|
@ -19,6 +19,7 @@ from typing import (
|
|||
import httpx # type: ignore
|
||||
import requests
|
||||
from openai import AsyncAzureOpenAI, AzureOpenAI
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import overload
|
||||
|
||||
import litellm
|
||||
|
@ -1534,7 +1535,12 @@ class AzureChatCompletion(BaseLLM):
|
|||
response = azure_client.audio.transcriptions.create(
|
||||
**data, timeout=timeout # type: ignore
|
||||
)
|
||||
stringified_response = response.model_dump()
|
||||
|
||||
if isinstance(response, BaseModel):
|
||||
stringified_response = response.model_dump()
|
||||
else:
|
||||
stringified_response = TranscriptionResponse(text=response).model_dump()
|
||||
|
||||
## LOGGING
|
||||
logging_obj.post_call(
|
||||
input=audio_file.name,
|
||||
|
@ -1587,7 +1593,10 @@ class AzureChatCompletion(BaseLLM):
|
|||
**data, timeout=timeout
|
||||
) # type: ignore
|
||||
|
||||
stringified_response = response.model_dump()
|
||||
if isinstance(response, BaseModel):
|
||||
stringified_response = response.model_dump()
|
||||
else:
|
||||
stringified_response = TranscriptionResponse(text=response).model_dump()
|
||||
|
||||
## LOGGING
|
||||
logging_obj.post_call(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue