agents
agents copied to clipboard
fix(voice): expose item_id on UserInputTranscribedEvent
Closes livekit/agents#6110
What
Adds item_id: str | None = None to UserInputTranscribedEvent and forwardsev.item_id from llm.InputTranscriptionCompleted inAgentActivity._on_input_audio_transcription_completed.
Why
Realtime models (OpenAI/xAI/Gemini) emit multiple interimuser_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_idcovering both the
populated and default-None cases ruff check/ruff format: cleanmypy(full project, 601 source files): 0 issues- Existing test suite: no regressions