Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
| # If an ID exists, continue using the current ID. | ||
| # When interruptions happens, user speech results in | ||
| # an interruption, which resets the context ID. | ||
| if not self._context_id: |
There was a problem hiding this comment.
Could we just move this logic to the base class?
There was a problem hiding this comment.
I don’t think we should for now. Most of the TTS services don’t save the context_id, and we already have a reference to it in each TTS service.
So maybe, in a follow up refactor, we can check which services are currently saving the context_id and refactor them. But for now, I would keep it like this.
There was a problem hiding this comment.
@markbackman, I’ve added this to our 1.0 wishlist, along with the other TTS improvements, so we can review how the classes are handling self._context_id. 👍
markbackman
left a comment
There was a problem hiding this comment.
LGTM.
This works as a temporary fix, but I agree that we'll want to make the API easier to work with in the future.
Summary
ElevenLabsTTSwhen processing multiple sentencescreate_context_id()override to 6 TTS services to properly reuse context IDs across multiplerun_ttsinvocationsTTSStartedFrameand start metrics once per turn, not once per sentenceThe Problem
When an LLM generates multiple sentences in a single turn (before
LLMFullResponseEndFrame), the baseTTSService.create_context_id()creates a new UUID for each sentence. This caused:The root cause: frames are only paused when receiving
LLMFullResponseEndFrame, but by that pointrun_tts()has been invoked multiple times (once per sentence). Some services need to reuse the samecontext_idacross all invocations within a turn.The Solution
Services that extend
AudioContextTTSServiceorAudioContextWordTTSServiceand maintainself._context_idfor turn tracking now overridecreate_context_id()to:self._context_idif one is already in progressself._context_idon interruptions or turn completionServices Fixed
Fixes #3723