Conversation
📝 WalkthroughWalkthroughAdds per-stream usage tracking to the Google STT plugin by introducing helper functions to extract audio duration and request IDs from streaming responses, then emits RECOGNITION_USAGE events. Also documents the audio_duration field in the STT base module. Changes
Sequence Diagram(s)sequenceDiagram
participant GCP as Google Cloud<br/>Speech API
participant Plugin as Google STT<br/>Plugin
participant Framework as Agent<br/>Framework
GCP->>Plugin: StreamingRecognizeResponse
Plugin->>Plugin: _get_audio_duration(response,<br/>last_usage_event_time)
Plugin->>Plugin: _get_request_id(response)
Plugin->>Plugin: Create SpeechEvent<br/>(type: RECOGNITION_USAGE)
Plugin->>Framework: Emit SpeechEvent<br/>(duration, request_id)
Plugin->>Plugin: Update last_usage_event_time
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-01-22T03:28:16.289ZApplied to files:
🧬 Code graph analysis (1)livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (3)
✏️ Tip: You can disable this entire section by setting Comment |
| # total_billed_time is only set "if this is the last response in the stream" | ||
| # use speech event time/offset before the last response is received | ||
| if isinstance(resp, cloud_speech_v2.StreamingRecognizeResponse): | ||
| if resp.metadata.total_billed_duration: |
There was a problem hiding this comment.
wouldn't this double count? i.e. adding total_billed_duration again in the end?
There was a problem hiding this comment.
Only the delta is returned, so it is only incremental.
commit c46013d Author: Long Chen <longch1024@gmail.com> Date: Tue Feb 3 20:02:57 2026 +0800 add exclude_config_update to ChatContext copy (livekit#4700) commit 7849a8c Author: Chenghao Mou <chenghao.mou@livekit.io> Date: Tue Feb 3 09:51:07 2026 +0000 fix: commit user turn with STT and realtime (livekit#4663) commit edfa391 Author: Chenghao Mou <chenghao.mou@livekit.io> Date: Tue Feb 3 09:48:36 2026 +0000 add STT usage for google (livekit#4599) commit 34d0d62 Author: Long Chen <longch1024@gmail.com> Date: Tue Feb 3 15:53:42 2026 +0800 fix gemini live tool execution interrupted by generation_complete event (livekit#4699) commit 1725929 Author: Long Chen <longch1024@gmail.com> Date: Tue Feb 3 11:08:27 2026 +0800 prevent tool cancellation when AgentTask is called inside it (livekit#4586)
This should close #4596
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.