From 37361391d9b896bc47941fd284b7ec7079e60597 Mon Sep 17 00:00:00 2001 From: padillamt Date: Fri, 25 Jul 2025 09:16:56 -0700 Subject: [PATCH] mtpadilla: removed ability to set base_url via constructor, set internally based on streaming variable --- src/pipecat/services/inworld/tts.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/pipecat/services/inworld/tts.py b/src/pipecat/services/inworld/tts.py index 68ada9720..6a3d6aa46 100644 --- a/src/pipecat/services/inworld/tts.py +++ b/src/pipecat/services/inworld/tts.py @@ -164,7 +164,6 @@ class InworldTTSService(TTSService): api_key: str, aiohttp_session: aiohttp.ClientSession, streaming: bool = True, - base_url: Optional[str] = None, sample_rate: Optional[int] = None, encoding: str = "LINEAR16", params: Optional[InputParams] = None, @@ -183,10 +182,9 @@ class InworldTTSService(TTSService): streaming: Whether to use streaming mode (True) or non-streaming mode (False). - True: Real-time audio chunks as they're generated (lower latency) - False: Complete audio file generated first, then chunked for playback (simpler) - base_url: Base URL for Inworld HTTP API. If None, automatically selected based on streaming mode: - - Streaming: "https://api.inworld.ai/tts/v1/voice:stream" - - Non-streaming: "https://api.inworld.ai/tts/v1/voice" - Should normally not be changed unless using a different environment. + The base URL is automatically selected based on this mode: + - Streaming: "https://api.inworld.ai/tts/v1/voice:stream" + - Non-streaming: "https://api.inworld.ai/tts/v1/voice" sample_rate: Audio sample rate in Hz. If None, uses default from StartFrame. Common values: 48000 (high quality), 24000 (good quality), 16000 (basic) encoding: Audio encoding format. Supported options: @@ -215,13 +213,11 @@ class InworldTTSService(TTSService): self._session = aiohttp_session # HTTP session for requests self._streaming = streaming # Streaming mode selection - # Set base URL based on streaming mode if not provided - if base_url is None: - if streaming: - base_url = "https://api.inworld.ai/tts/v1/voice:stream" # Streaming endpoint - else: - base_url = "https://api.inworld.ai/tts/v1/voice" # Non-streaming endpoint - self._base_url = base_url # API endpoint URL + # Set base URL based on streaming mode + if streaming: + self._base_url = "https://api.inworld.ai/tts/v1/voice:stream" # Streaming endpoint + else: + self._base_url = "https://api.inworld.ai/tts/v1/voice" # Non-streaming endpoint # Build settings dictionary that matches Inworld's API expectations # This will be sent as JSON payload in each TTS request