Is it possible to swap out the STT node on AgentSe...
# ask-ai
n
Is it possible to swap out the STT node on AgentSession? The use case is swapping out languages on deepgram mid-way through a conversation.
t
Thanks for reaching out, Stephen. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely! You can definitely swap out the STT node on
AgentSession
mid-conversation to switch languages when using Deepgram. This is done using the
update_options
method, which lets you dynamically update the Deepgram STT settings during an active session. For instance, you can change the
language
parameter to your desired language code (like
fr-CA
for French), and the change will take effect right away for any new audio input. What’s great is that the
update_options
method also applies these updates to all active
SpeechStream
instances, so you get smooth language switching without needing to restart the agent. If you’d like, I’m here to provide more details or examples—just let me know! Sources: livekit-plugins/livekit-plugins-gladia/livekit/plugins/gladia/stt.py | pipeline-tts/elevenlabs_change_language.py | LiveKit turn detector plugin | LiveKit Docs | Gladia integration guide | LiveKit Docs
n
How can I do this with deepgram STT?
t
If you'd like to swap out the Deepgram STT node mid-conversation, you can easily do this using the
update_options
method. Let me walk you through the steps: 1. First, find the correct Deepgram language code for the language you want to switch to (for example,
en-US
for English or
fr-CA
for French). 2. Next, call the
update_options
method on your Deepgram STT instance, passing in the new language code. It looks like this:
Copy code
self.stt.update_options(language="fr-CA")
This will update the language setting right away for your STT instance and apply the change to all active
SpeechStream
instances. So, the very next audio input will be transcribed in the new language you selected. If you have any questions or would like me to provide a more detailed example, just let me know—I’m here to help!