mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix type errors on transcription azure
This commit is contained in:
parent
7e2d383885
commit
fbc0c8b116
1 changed files with 8 additions and 2 deletions
|
@ -4951,6 +4951,10 @@ async def atranscription(*args, **kwargs) -> TranscriptionResponse:
|
||||||
else:
|
else:
|
||||||
# Call the synchronous function using run_in_executor
|
# Call the synchronous function using run_in_executor
|
||||||
response = await loop.run_in_executor(None, func_with_context)
|
response = await loop.run_in_executor(None, func_with_context)
|
||||||
|
if not isinstance(response, TranscriptionResponse):
|
||||||
|
raise ValueError(
|
||||||
|
f"Invalid response from transcription provider, expected TranscriptionResponse, but got {type(response)}"
|
||||||
|
)
|
||||||
return response
|
return response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
custom_llm_provider = custom_llm_provider or "openai"
|
custom_llm_provider = custom_llm_provider or "openai"
|
||||||
|
@ -4984,7 +4988,7 @@ def transcription(
|
||||||
max_retries: Optional[int] = None,
|
max_retries: Optional[int] = None,
|
||||||
custom_llm_provider=None,
|
custom_llm_provider=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> TranscriptionResponse:
|
) -> Union[TranscriptionResponse, Coroutine[Any, Any, TranscriptionResponse]]:
|
||||||
"""
|
"""
|
||||||
Calls openai + azure whisper endpoints.
|
Calls openai + azure whisper endpoints.
|
||||||
|
|
||||||
|
@ -5053,7 +5057,9 @@ def transcription(
|
||||||
custom_llm_provider=custom_llm_provider,
|
custom_llm_provider=custom_llm_provider,
|
||||||
)
|
)
|
||||||
|
|
||||||
response: Optional[TranscriptionResponse] = None
|
response: Optional[
|
||||||
|
Union[TranscriptionResponse, Coroutine[Any, Any, TranscriptionResponse]]
|
||||||
|
] = None
|
||||||
if custom_llm_provider == "azure":
|
if custom_llm_provider == "azure":
|
||||||
# azure configs
|
# azure configs
|
||||||
api_base = api_base or litellm.api_base or get_secret_str("AZURE_API_BASE")
|
api_base = api_base or litellm.api_base or get_secret_str("AZURE_API_BASE")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue