How quickly does the update_options function work?...
# ask-ai
m
How quickly does the update_options function work? I want to change the voice of the tts model depending on some parameters from the LLM output. Will this be feasible with update_options before the TTS triggers in the same turn? Or does update_options work on the next turn?
t
Thanks for reaching out, Alexander. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — regarding your question about
update_options
and TTS voice changes: •
update_options
takes effect on the next utterance, not the current one. It will not change the voice for a TTS synthesis already queued or in progress. • That means you cannot reliably switch the TTS voice within the same turn using
update_options
. If you need dynamic voice changes within a single turn, two alternatives to consider: • Generate separate TTS audio clips ahead of playback (one per desired voice) and play the appropriate clip when your LLM output determines the voice. • Use a TTS engine that supports mid-utterance voice switching (if available for your setup) and stitch or stream segments with different voices. Would you like help designing the pre-generation approach (how to request multiple voices and play the chosen clip), or do you want me to check which TTS plugins you’re using so I can give plugin-specific guidance? Sources: Hume TTS plugin guide | LiveKit Docs | Gladia STT plugin guide | LiveKit Docs
m
You're saying have two TTS instances and call one or the other depending on the language?
t
You're close — you don't strictly need two running TTS instances. Options: • Request separate TTS utterances with the desired voice per call: for each turn, call TTS twice (or as many voices as needed) with different `voice`/options, then play the clip that matches the LLM output. • Or keep two configured TTS clients/instances (one per language/voice) and call the appropriate one when you know the language — functionally equivalent, sometimes simpler if your SDK/client ties options to an instance. Which you pick depends on your flow: • If you decide voice after generating the LLM text, pre-generate multiple clips per turn and choose the right clip at playtime. • If you can determine the voice before calling TTS, invoke only the matching voice (single request). Do you want a short example of pre-generating clips and selecting one, or guidance for maintaining multiple TTS clients?
m
For context it’ll be the same TTS provider plugin. I think two TTS clients makes sense. Any downside compared to the pre generating clips approach?
t
Good question — here’s a concise comparison so you can pick what fits your flow. Trade-offs: two TTS clients (same provider) vs. pre-generating clips • Latency ◦ Two clients: lower runtime latency when you decide voice late — call the selected client and stream/play immediately. ◦ Pre-generate: extra upfront latency per turn to create multiple clips (unless generated ahead of time), but selection/playback is instant. • Cost ◦ Two clients: billing is per TTS request/second — only the chosen request is billed at runtime. ◦ Pre-generate: you pay for every clip you generate, even unused ones, so higher cost if many alternatives per turn. • Complexity ◦ Two clients: simpler runtime logic (choose a client → request). Slightly more setup to maintain multiple client instances/configs. ◦ Pre-generate: more orchestration to request, store, and manage multiple clips per turn and to clean up unused clips. • Resource usage & storage ◦ Two clients: minimal storage; transient audio only for the chosen utterance. ◦ Pre-generate: requires storage and lifecycle management for generated clips (cache, eviction). • Flexibility ◦ Two clients: easy if you can determine voice just before TTS. Less suited if you need to branch mid-utterance. ◦ Pre-generate: lets you pick among arbitrary variations (voice, prosody, language) that were prepared in advance. • Reliability ◦ Two clients: one network/TTS call at play time — fewer points of failure if selection is quick. ◦ Pre-generate: more calls overall; failure handling for each pre-gen clip needed. Recommendation • If you only need 2–3 predictable voices/languages and want minimal storage/cost, run two configured clients and call the matching one at runtime. • If you need many variants per turn or want instant switching with no runtime TTS call, pre-generate clips (accepting higher cost/storage). Would you like a short code sketch for maintaining two clients with your SDK/plugin or an example pre-generation flow?