services: pass **kwargs to TTService

This commit is contained in:
Aleix Conchillo Flaqué
2024-05-14 18:46:03 -07:00
parent 6247b9df39
commit 0b01eb5a11
4 changed files with 19 additions and 16 deletions

View File

@@ -35,8 +35,8 @@ except ModuleNotFoundError as e:
class AzureTTSService(TTSService):
def __init__(self, *, api_key, region, voice="en-US-SaraNeural"):
super().__init__()
def __init__(self, *, api_key: str, region: str, voice="en-US-SaraNeural", **kwargs):
super().__init__(**kwargs)
self.speech_config = SpeechConfig(subscription=api_key, region=region)
self.speech_synthesizer = SpeechSynthesizer(

View File

@@ -4,6 +4,8 @@
# SPDX-License-Identifier: BSD 2-Clause License
#
import aiohttp
from typing import AsyncGenerator
from pipecat.frames.frames import AudioRawFrame, Frame
@@ -17,10 +19,11 @@ class DeepgramTTSService(TTSService):
def __init__(
self,
*,
aiohttp_session,
api_key,
voice="alpha-asteria-en-v2"):
super().__init__()
aiohttp_session: aiohttp.ClientSession,
api_key: str,
voice: str = "alpha-asteria-en-v2",
**kwargs):
super().__init__(**kwargs)
self._voice = voice
self._api_key = api_key

View File

@@ -17,14 +17,14 @@ from loguru import logger
class ElevenLabsTTSService(TTSService):
def __init__(
self,
*,
aiohttp_session: aiohttp.ClientSession,
api_key: str,
voice_id: str,
model: str = "eleven_turbo_v2",
):
super().__init__()
self,
*,
aiohttp_session: aiohttp.ClientSession,
api_key: str,
voice_id: str,
model: str = "eleven_turbo_v2",
**kwargs):
super().__init__(**kwargs)
self._api_key = api_key
self._voice_id = voice_id

View File

@@ -27,8 +27,8 @@ except ModuleNotFoundError as e:
class PlayHTAIService(TTSService):
def __init__(self, *, api_key, user_id, voice_url):
super().__init__()
def __init__(self, *, api_key: str, user_id: str, voice_url: str, **kwargs):
super().__init__(**kwargs)
self._user_id = user_id
self._speech_key = api_key