Add VADUserTurnStopStrategy for VAD-only realtime pipelines

Provides a dedicated stop strategy that triggers on VADUserStoppedSpeakingFrame
without requiring a turn analyzer or transcriptions. Complements the existing
VADTurnAnalyzerUserTurnStopStrategy and matches the one-per-modality convention
already used in user_start/.
This commit is contained in:
Mark Backman
2026-04-20 10:01:42 -04:00
parent 2e5e109bb6
commit 3077395ffc
6 changed files with 126 additions and 7 deletions

View File

@@ -7,7 +7,6 @@
"""Tests for VADTurnAnalyzerUserTurnStopStrategy."""
import unittest
from typing import Optional, Tuple
from unittest.mock import AsyncMock
import pytest
@@ -40,7 +39,7 @@ class MockTurnAnalyzer(BaseTurnAnalyzer):
super().__init__()
self._append_audio_state = EndOfTurnState.INCOMPLETE
self._analyze_state = EndOfTurnState.INCOMPLETE
self._prediction: Optional[MetricsData] = None
self._prediction: MetricsData | None = None
self._speech_triggered = False
@property
@@ -54,7 +53,7 @@ class MockTurnAnalyzer(BaseTurnAnalyzer):
def append_audio(self, buffer: bytes, is_speech: bool) -> EndOfTurnState:
return self._append_audio_state
async def analyze_end_of_turn(self) -> Tuple[EndOfTurnState, Optional[MetricsData]]:
async def analyze_end_of_turn(self) -> tuple[EndOfTurnState, MetricsData | None]:
return self._analyze_state, self._prediction
def update_vad_start_secs(self, vad_start_secs: float):