Bound streaming fallback latency#11
Conversation
EntelligenceAI PR SummaryRefactors streaming transcription logic in
Confidence Score: 5/5 - Safe to MergeSafe to merge — this PR refactors streaming transcription logic in Key Findings:
Files requiring special attention
|
WalkthroughThis PR refactors streaming transcription handling in Changes
Sequence DiagramThis diagram shows the interactions between components: sequenceDiagram
participant App as Application
participant StreamHandler as Streaming Handler
participant BatchVerifier as verify_streaming_transcript
participant Transcriber as transcribe_with_model
participant STT as STT API (Telnyx)
participant Overlay as Overlay UI
App->>StreamHandler: streaming transcript received
activate StreamHandler
Note over StreamHandler: Check streaming_batch_fallback_reason()
Note over StreamHandler: source "final" or "stable_best_available" -> no fallback reason
Note over StreamHandler: other sources -> "non_final_streaming_result"
alt source is "final" or "stable_best_available"
StreamHandler->>BatchVerifier: verify_streaming_transcript(wav, warmup)
activate BatchVerifier
Note over BatchVerifier: timeout = STREAMING_BATCH_VERIFY_TIMEOUT (2s)
BatchVerifier->>Transcriber: transcribe_with_model(..., timeout=2s)
activate Transcriber
Transcriber->>STT: POST /stt with per-request timeout
STT-->>Transcriber: batch transcript
deactivate Transcriber
Transcriber-->>BatchVerifier: batch result
BatchVerifier-->>StreamHandler: batch transcript
deactivate BatchVerifier
alt batch word count > streaming word count
StreamHandler->>App: use batch transcript
else streaming word count >= batch
StreamHandler->>App: use streaming transcript
end
else non-final source
StreamHandler->>App: skip batch verification (non_final_streaming_result)
end
deactivate StreamHandler
App->>App: insert text & record metrics
App->>Overlay: send Overlay(Copied)
App->>Overlay: HideOverlayAfter(POST_INSERT_OVERLAY_HOLD = 300ms)
Note over App, STT: Full transcription path uses STT_REQUEST_TIMEOUT (12s)
Note over BatchVerifier, STT: Batch verification uses STREAMING_BATCH_VERIFY_TIMEOUT (2s)
|
What changed
Why
Recent local logs showed Bolo remaining in Thinking for 16 seconds even though usable streaming text was already available. The synchronous batch verification request timed out and retried before allowing insertion.
Verification