fix(voice): expose item_id on UserInputTranscribedEvent#6172
Open
DIYA73 wants to merge 2 commits into
Open
Conversation
Forward item_id from llm.InputTranscriptionCompleted to UserInputTranscribedEvent, which was previously dropped when the framework re-emitted the event upward. This lets consumers correlate repeated interim transcription events belonging to the same utterance (e.g. realtime models like OpenAI/xAI/Gemini emit multiple interim events per utterance), enabling provider-agnostic dedup without relying on provider-specific raw events. Closes livekit#6110
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6110
What
Adds
item_id: str | None = NonetoUserInputTranscribedEventand forwardsev.item_idfromllm.InputTranscriptionCompletedinAgentActivity._on_input_audio_transcription_completed.Why
Realtime models (OpenAI/xAI/Gemini) emit multiple interim
user_input_transcribedevents per utterance.InputTranscriptionCompletedalready carries a stable
item_idto correlate these, but it was beingdropped when re-emitted as
UserInputTranscribedEvent, forcing consumers toeither track state manually (impossible — the field wasn't exposed) or
subscribe to provider-specific raw events.
Testing
test_user_input_transcribed_event_item_idcovering both thepopulated and default-None cases
ruff check/ruff format: cleanmypy(full project, 601 source files): 0 issues