DeepgramTTSService: use Deepgram's asyncrest instead of asyncio.to_thread

This commit is contained in:
Aleix Conchillo Flaqué
2025-04-16 12:02:11 -07:00
parent 6cea71270e
commit 31f7082d12

View File

@@ -4,7 +4,6 @@
# SPDX-License-Identifier: BSD 2-Clause License
#
import asyncio
from typing import AsyncGenerator, Optional
from loguru import logger
@@ -60,8 +59,8 @@ class DeepgramTTSService(TTSService):
try:
await self.start_ttfb_metrics()
response = await asyncio.to_thread(
self._deepgram_client.speak.v("1").stream, {"text": text}, options
response = await self._deepgram_client.speak.asyncrest.v("1").stream_memory(
{"text": text}, options
)
await self.start_tts_usage_metrics(text)