I am using livekit and deepgram, initally i am sta...
# ask-ai
s
I am using livekit and deepgram, initally i am starting my agent with english langauage tts and stt, but i want a suggestion how can i change the model tts and stt during call if someone speaks spanish
t
Thanks for reaching out, Abdullah. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m happy to help you with dynamically changing TTS and STT models during a call when a different language, like Spanish, is detected. You can achieve this by using the
update_options()
method on both your TTS and STT instances. Here’s a simple overview to guide you: • Automatic Language Detection: Consider using a multilingual STT model like Deepgram Nova-3 with
language="multi"
for automatic detection, or Gladia STT with
languages=[]
for auto-detection and even code-switching. • Dynamic Updates: Once a new language is detected, you can update the TTS and STT models by calling
update_options()
to switch to the right language settings. • Implementation: Keep an eye on speech events to spot language changes, and then dynamically update the models. For example, if Spanish is detected, you’d update both TTS and STT to use Spanish-specific configurations. If you’d like, I’d be more than happy to share detailed code examples or walk you through the implementation step-by-step. Just let me know how I can assist! Sources: pipeline-tts/tts_comparison/README.md | Speech-to-text (STT) models | LiveKit Docs | Gladia STT plugin guide | LiveKit Docs | Cartesia STT plugin guide | LiveKit Docs | livekit-plugins/livekit-plugins-neuphonic/livekit/plugins/neuphonic/models....
s
tell me about update_options() where can i find the code and documentation for it?
t
I'm glad you're interested in the
update_options()
method! It's a handy feature implemented across various LiveKit components and plugins that lets you adjust configuration options on the fly during runtime. Let me share some important details with you: • Code Locations: You can explore the implementations in the LiveKit Agents repository here: https://github.com/livekit/agents. Some specific files include: ◦ Deepgram STT:
livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt.py
◦ Gladia STT:
livekit-plugins/livekit-plugins-gladia/livekit/plugins/gladia/stt.py
◦ FireworksAI STT:
livekit-plugins/livekit-plugins-fireworksai/livekit/plugins/fireworksai/stt.py
• Documentation: The method is well documented for different plugins, showing how you can update parameters like language, model, and other settings dynamically. For instance, Deepgram STT supports parameters such as
language
,
model
, and
interim_results
. • Usage: This method makes it easy to update options like language or model mid-session, and these changes take effect right away or with the next utterance. If you’d like, I’m here to help you with a specific implementation or use case for
update_options()
. Just let me know! Sources: livekit-plugins/livekit-plugins-gladia/livekit/plugins/gladia/stt.py | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Hume TTS plugin guide | LiveKit Docs