Skip to content

fix(elevenlabs): add validation warnings for out-of-range VoiceSettings#4775

Open
williamwarlick wants to merge 1 commit intolivekit:mainfrom
williamwarlick:fix/elevenlabs-voice-settings-validation
Open

fix(elevenlabs): add validation warnings for out-of-range VoiceSettings#4775
williamwarlick wants to merge 1 commit intolivekit:mainfrom
williamwarlick:fix/elevenlabs-voice-settings-validation

Conversation

@williamwarlick
Copy link

Closes #4774

Summary

  • Add _validate_voice_settings() that logs warnings when VoiceSettings params are outside their documented ElevenLabs API ranges — follows the same pattern as Cartesia's _check_generation_config()
  • Call validation from both TTS.__init__() and TTS.update_options()
  • Fix speed range comment: [0.8 - 1.2] -> [0.7 - 1.2] per ElevenLabs API docs

Motivation

Out-of-range VoiceSettings values (e.g. speed=0.5) get sent straight to the 11labs API which silently clamps them. The voice fails and there's nothing in the logs to indicate why. The Cartesia plugin already handles this with _check_generation_config() — this brings the ElevenLabs plugin to the same level.

Warnings are non-blocking (logger.warning with extra={}) so values still pass through.

Validated Ranges

Parameter Range
stability 0.0 - 1.0
similarity_boost 0.0 - 1.0
style 0.0 - 1.0
speed 0.7 - 1.2

Add _validate_voice_settings() that logs warnings when VoiceSettings
parameters are outside their documented ElevenLabs API ranges. Called
from both TTS.__init__() and TTS.update_options(). Follows the same
pattern as Cartesia's _check_generation_config().

Also fix speed range comment from [0.8 - 1.2] to [0.7 - 1.2] per
ElevenLabs API docs.

Closes livekit#4774
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Copy link
Contributor

@longcw longcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ElevenLabs VoiceSettings silently accepts out-of-range values — voice failed with no indication why

2 participants