fix type errors on transcription azure
This commit is contained in:
parent
b20a69f9fc
commit
7384d45ef0
@ -4951,6 +4951,10 @@ async def atranscription(*args, **kwargs) -> TranscriptionResponse:
|
||||
else:
|
||||
# Call the synchronous function using run_in_executor
|
||||
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
|
||||
except Exception as e:
|
||||
custom_llm_provider = custom_llm_provider or "openai"
|
||||
@ -4984,7 +4988,7 @@ def transcription(
|
||||
max_retries: Optional[int] = None,
|
||||
custom_llm_provider=None,
|
||||
**kwargs,
|
||||
) -> TranscriptionResponse:
|
||||
) -> Union[TranscriptionResponse, Coroutine[Any, Any, TranscriptionResponse]]:
|
||||
"""
|
||||
Calls openai + azure whisper endpoints.
|
||||
|
||||
@ -5053,7 +5057,9 @@ def transcription(
|
||||
custom_llm_provider=custom_llm_provider,
|
||||
)
|
||||
|
||||
response: Optional[TranscriptionResponse] = None
|
||||
response: Optional[
|
||||
Union[TranscriptionResponse, Coroutine[Any, Any, TranscriptionResponse]]
|
||||
] = None
|
||||
if custom_llm_provider == "azure":
|
||||
# azure configs
|
||||
api_base = api_base or litellm.api_base or get_secret_str("AZURE_API_BASE")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user