diff --git a/CHANGELOG.md b/CHANGELOG.md index 096e26abc..a8fee8db6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ https://en.wikipedia.org/wiki/Saint_George%27s_Day_in_Catalonia ### Changed +- The `InputParams` for `ElevenLabsTTSService` and `ElevenLabsHttpTTSService` + no longer require that `stability` and `similarity_boost` be set. You can + individually set each param. + - In `TwilioFrameSerializer`, `call_sid` is Optional so as to avoid a breaking changed. `call_sid` is required to automatically hang up. diff --git a/src/pipecat/services/elevenlabs/tts.py b/src/pipecat/services/elevenlabs/tts.py index 5676a7709..b9a22b388 100644 --- a/src/pipecat/services/elevenlabs/tts.py +++ b/src/pipecat/services/elevenlabs/tts.py @@ -126,31 +126,14 @@ def build_elevenlabs_voice_settings( settings: Dictionary containing voice settings parameters Returns: - Dictionary of voice settings or None if required parameters are missing + Dictionary of voice settings or None if no valid settings are provided """ + voice_setting_keys = ["stability", "similarity_boost", "style", "use_speaker_boost", "speed"] + voice_settings = {} - if settings["stability"] is not None and settings["similarity_boost"] is not None: - voice_settings["stability"] = settings["stability"] - voice_settings["similarity_boost"] = settings["similarity_boost"] - if settings["style"] is not None: - voice_settings["style"] = settings["style"] - if settings["use_speaker_boost"] is not None: - voice_settings["use_speaker_boost"] = settings["use_speaker_boost"] - if settings["speed"] is not None: - voice_settings["speed"] = settings["speed"] - else: - if settings["style"] is not None: - logger.warning( - "'style' is set but will not be applied because 'stability' and 'similarity_boost' are not both set." - ) - if settings["use_speaker_boost"] is not None: - logger.warning( - "'use_speaker_boost' is set but will not be applied because 'stability' and 'similarity_boost' are not both set." - ) - if settings["speed"] is not None: - logger.warning( - "'speed' is set but will not be applied because 'stability' and 'similarity_boost' are not both set." - ) + for key in voice_setting_keys: + if key in settings and settings[key] is not None: + voice_settings[key] = settings[key] return voice_settings or None