-
Notifications
You must be signed in to change notification settings - Fork 2.9k
AGT-2474: add commit user turn support for realtime models #4622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -976,6 +976,9 @@ def clear_user_turn(self) -> None: | |||||||||||||||||||||
| self._rt_session.clear_audio() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def commit_user_turn(self, *, transcript_timeout: float, stt_flush_duration: float) -> None: | ||||||||||||||||||||||
| if self._rt_session is not None: | ||||||||||||||||||||||
| self._rt_session.commit_user_turn() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Comment on lines
978
to
+981
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check for commit_user_turn implementation and exception types
rg -n "def commit_user_turn" --type py -A 5Repository: livekit/agents Length of output: 6596 🏁 Script executed: #!/bin/bash
# Search for llm.RealtimeError or similar exception definitions
rg -n "class.*RealtimeError|RealtimeError" --type py -A 2Repository: livekit/agents Length of output: 9008 🏁 Script executed: #!/bin/bash
# Check the context around lines 978-981 to see what follows commit_user_turn
sed -n '975,990p' livekit-agents/livekit/agents/voice/agent_activity.pyRepository: livekit/agents Length of output: 782 🏁 Script executed: #!/bin/bash
# Search for AudioRecognition.commit_user_turn to understand the full flow
rg -n "AudioRecognition.*commit_user_turn|\.commit_user_turn" livekit-agents/livekit/agents/voice/agent_activity.py -B 2 -A 2Repository: livekit/agents Length of output: 494 Wrap realtime commit to ensure STT commit always runs. The Suggested fix if self._rt_session is not None:
- self._rt_session.commit_user_turn()
+ try:
+ self._rt_session.commit_user_turn()
+ except llm.RealtimeError:
+ logger.exception("failed to commit user turn on realtime session")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| assert self._audio_recognition is not None | ||||||||||||||||||||||
| self._audio_recognition.commit_user_turn( | ||||||||||||||||||||||
| audio_detached=not self._session.input.audio_enabled, | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can be simplified to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think commit audio alone works and we don't really need any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#4663