diff --git a/examples/foundational/55zb-update-settings-inworld-tts.py b/examples/foundational/55zb-update-settings-inworld-tts.py index d9947c196..f8a66bdd8 100644 --- a/examples/foundational/55zb-update-settings-inworld-tts.py +++ b/examples/foundational/55zb-update-settings-inworld-tts.py @@ -97,9 +97,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): await task.queue_frames([LLMRunFrame()]) await asyncio.sleep(10) - logger.info("Updating Inworld TTS settings: speaking_rate=1.3, temperature=0.8") + logger.info("Updating Inworld TTS settings: speaking_rate=1.5, temperature=0.8") await task.queue_frame( - TTSUpdateSettingsFrame(update=InworldTTSSettings(speaking_rate=1.3, temperature=0.8)) + TTSUpdateSettingsFrame(update=InworldTTSSettings(speaking_rate=1.5, temperature=0.8)) ) @transport.event_handler("on_client_disconnected") diff --git a/src/pipecat/services/inworld/tts.py b/src/pipecat/services/inworld/tts.py index acc6187cb..fea30f3a1 100644 --- a/src/pipecat/services/inworld/tts.py +++ b/src/pipecat/services/inworld/tts.py @@ -184,25 +184,6 @@ class InworldHttpTTSService(WordTTSService): """ return True - async def _update_settings(self, update: TTSSettings) -> dict[str, Any]: - """Apply a settings update. - - Settings are stored but not applied to the active connection. - """ - changed = await super()._update_settings(update) - - if not changed: - return changed - - # TODO: someday we could reconnect here to apply updated settings. - # Code might look something like the below: - # await self._disconnect() - # await self._connect() - - self._warn_unhandled_updated_settings(changed) - - return changed - async def start(self, frame: StartFrame): """Start the Inworld TTS service. @@ -756,6 +737,21 @@ class InworldTTSService(AudioContextWordTTSService): await self._disconnect_websocket() + async def _update_settings(self, update: TTSSettings) -> dict[str, Any]: + """Apply a settings update. + + Settings are stored but not applied to the active connection. + """ + changed = await super()._update_settings(update) + + if not changed: + return changed + + await self._disconnect() + await self._connect() + + return changed + async def _connect_websocket(self): """Connect to the Inworld WebSocket TTS service.