salmon-lighter-12882
11/14/2025, 1:21 PMtall-airline-16756
11/14/2025, 1:21 PMtall-airline-16756
11/14/2025, 1:22 PMVoiceSettings dataclass instance is expected. This usually happens when the dataclasses.asdict() function is called on the voice_settings parameter.
Here’s a friendly guide to help you resolve this:
1. First, please make sure that voice_settings is indeed a VoiceSettings dataclass instance. For example:
from livekit.plugins.elevenlabs import TTS, VoiceSettings
tts = TTS(
voice_id="your_voice_id",
voice_settings=VoiceSettings(
stability=0.75,
similarity_boost=0.75,
style=0.5,
use_speaker_boost=True
)
)
1. If your data is coming dynamically (like from JSON), you can unpack it into the VoiceSettings constructor using the ** operator, like this:
data = {"stability": 0.7, "similarity_boost": 0.8}
voice_settings = VoiceSettings(**data)
tts = TTS(voice_settings=voice_settings)
Just a gentle reminder: avoid passing raw dictionaries directly to the voice_settings parameter, as this will cause the error you saw. If you have any questions or need a hand with this, please don’t hesitate to ask—I’m here to help!
Sources: livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/tts.py | ElevenLabs TTS plugin guide | LiveKit Docs