mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
fix(speech): call Gemini once per TTS request
aspeech re-ran speech whenever the first result was not a coroutine, so the
speech-to-completion bridge sent every async Gemini and Vertex AI TTS request
upstream twice. It now returns the sync result
Prerequisite for the backport of #50803 to lts/1.108.x, whose tests count one
upstream request per speech call.
Hand-ported from f4347d4f50 (#44551, main), the aspeech hunk only.
This commit is contained in:
parent
6e7600bbff
commit
ef66d75951
1 changed files with 1 additions and 7 deletions
|
|
@ -8430,14 +8430,8 @@ async def aspeech(*args, **kwargs) -> HttpxBinaryResponseContent:
|
|||
api_base=api_base_hint,
|
||||
)
|
||||
|
||||
# Await normally
|
||||
init_response: Final = await loop.run_in_executor(None, func_with_context)
|
||||
if asyncio.iscoroutine(init_response):
|
||||
response = await init_response
|
||||
else:
|
||||
# Call the synchronous function using run_in_executor
|
||||
response = await loop.run_in_executor(None, func_with_context)
|
||||
return response
|
||||
return await init_response if asyncio.iscoroutine(init_response) else init_response
|
||||
except Exception as e:
|
||||
custom_llm_provider = custom_llm_provider or "openai"
|
||||
raise exception_type(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue