agents icon indicating copy to clipboard operation
agents copied to clipboard

fix(voice): expose item_id on UserInputTranscribedEvent

Open DIYA73 opened this issue 5 months ago • 1 comments

Closes livekit/agents#6110

What

Adds item_id: str | None = None to UserInputTranscribedEvent and forwards
ev.item_id from llm.InputTranscriptionCompleted in
AgentActivity._on_input_audio_transcription_completed.

Why

Realtime models (OpenAI/xAI/Gemini) emit multiple interim
user_input_transcribed events per utterance. InputTranscriptionCompleted
already carries a stable item_id to correlate these, but it was being
dropped when re-emitted as UserInputTranscribedEvent, forcing consumers to
either track state manually (impossible — the field wasn't exposed) or
subscribe to provider-specific raw events.

Testing

  • Added test_user_input_transcribed_event_item_id covering both the
    populated and default-None cases
  • ruff check / ruff format: clean
  • mypy (full project, 601 source files): 0 issues
  • Existing test suite: no regressions

DIYA73 avatar Jun 20 '26 14:06 DIYA73

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 20 '26 14:06 CLAassistant