Skip to content

Commit b23ca5a

Browse files
authored
Merge pull request #1641 from pipecat-ai/mb/11labs-input-params
ElevenLabs: InputParams can be set individually
2 parents f1e45d0 + 63a6697 commit b23ca5a

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ https://en.wikipedia.org/wiki/Saint_George%27s_Day_in_Catalonia
2020

2121
### Changed
2222

23+
- The `InputParams` for `ElevenLabsTTSService` and `ElevenLabsHttpTTSService`
24+
no longer require that `stability` and `similarity_boost` be set. You can
25+
individually set each param.
26+
2327
- In `TwilioFrameSerializer`, `call_sid` is Optional so as to avoid a breaking
2428
changed. `call_sid` is required to automatically hang up.
2529

src/pipecat/services/elevenlabs/tts.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,14 @@ def build_elevenlabs_voice_settings(
126126
settings: Dictionary containing voice settings parameters
127127
128128
Returns:
129-
Dictionary of voice settings or None if required parameters are missing
129+
Dictionary of voice settings or None if no valid settings are provided
130130
"""
131+
voice_setting_keys = ["stability", "similarity_boost", "style", "use_speaker_boost", "speed"]
132+
131133
voice_settings = {}
132-
if settings["stability"] is not None and settings["similarity_boost"] is not None:
133-
voice_settings["stability"] = settings["stability"]
134-
voice_settings["similarity_boost"] = settings["similarity_boost"]
135-
if settings["style"] is not None:
136-
voice_settings["style"] = settings["style"]
137-
if settings["use_speaker_boost"] is not None:
138-
voice_settings["use_speaker_boost"] = settings["use_speaker_boost"]
139-
if settings["speed"] is not None:
140-
voice_settings["speed"] = settings["speed"]
141-
else:
142-
if settings["style"] is not None:
143-
logger.warning(
144-
"'style' is set but will not be applied because 'stability' and 'similarity_boost' are not both set."
145-
)
146-
if settings["use_speaker_boost"] is not None:
147-
logger.warning(
148-
"'use_speaker_boost' is set but will not be applied because 'stability' and 'similarity_boost' are not both set."
149-
)
150-
if settings["speed"] is not None:
151-
logger.warning(
152-
"'speed' is set but will not be applied because 'stability' and 'similarity_boost' are not both set."
153-
)
134+
for key in voice_setting_keys:
135+
if key in settings and settings[key] is not None:
136+
voice_settings[key] = settings[key]
154137

155138
return voice_settings or None
156139

0 commit comments

Comments
 (0)