Skip to content

feat: add item_id to UserInputTranscribedEvent for per-utterance dedup#6247

Open
C1-BA-B1-F3 wants to merge 1 commit into
livekit:mainfrom
C1-BA-B1-F3:fix/user-input-transcribed-item-id
Open

feat: add item_id to UserInputTranscribedEvent for per-utterance dedup#6247
C1-BA-B1-F3 wants to merge 1 commit into
livekit:mainfrom
C1-BA-B1-F3:fix/user-input-transcribed-item-id

Conversation

@C1-BA-B1-F3

Copy link
Copy Markdown

Problem

UserInputTranscribedEvent doesn't include any identifier for the utterance being transcribed. This makes it impossible for callers to deduplicate interim transcription results or correlate a final transcript back to its preceding interim updates.

Fixes #6109

Solution

Add an optional item_id field to UserInputTranscribedEvent:

  • Realtime models: populated from InputTranscriptionCompleted.item_id
  • STT pipelines: populated from SpeechEvent.request_id
  • Defaults to None when no upstream identifier is available (e.g. IVR, speech-stopped events)

Changes

  • events.py: Add item_id: str | None = None field with docstring
  • agent_activity.py: Populate item_id in all three event creation sites

Testing

All 78 existing tests pass.

Add an optional `item_id` field to `UserInputTranscribedEvent` so callers can
group interim and final transcription results belonging to the same utterance.

- For realtime models: populated from `InputTranscriptionCompleted.item_id`
- For STT pipelines: populated from `SpeechEvent.request_id`
- Defaults to `None` when no upstream identifier is available

Fixes livekit#6109
@C1-BA-B1-F3 C1-BA-B1-F3 requested a review from a team as a code owner June 26, 2026 13:51

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 potential issues.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UserInputTranscribedEvent drops item_id, making per-utterance dedup of interim transcripts impossible without provider-specific events

1 participant