Changing the default behavior to only use the last vad segment, and increasing the default stop_secs to 3

This commit is contained in:
Filipi Fuchter
2025-04-17 16:07:03 -03:00
parent e179916c9c
commit 3599761e4e

View File

@@ -21,17 +21,18 @@ class EndOfTurnState(Enum):
# Default timing parameters
STOP_SECS = 1
STOP_SECS = 3
PRE_SPEECH_MS = 0
MAX_DURATION_SECONDS = 8 # Max allowed segment duration
USE_ONLY_LAST_VAD_SEGMENT = False
USE_ONLY_LAST_VAD_SEGMENT = True
class SmartTurnParams(BaseModel):
stop_secs: float = STOP_SECS
pre_speech_ms: float = PRE_SPEECH_MS
max_duration_secs: float = MAX_DURATION_SECONDS
use_only_last_vad_segment: bool = USE_ONLY_LAST_VAD_SEGMENT
# not exposing this for now yet until the model can handle it.
# use_only_last_vad_segment: bool = USE_ONLY_LAST_VAD_SEGMENT
class BaseSmartTurn(ABC):
@@ -99,7 +100,7 @@ class BaseSmartTurn(ABC):
def analyze_end_of_turn(self) -> EndOfTurnState:
logger.debug("Analyzing End of Turn...")
state = self._process_speech_segment(self._audio_buffer)
if state == EndOfTurnState.COMPLETE or self._params.use_only_last_vad_segment:
if state == EndOfTurnState.COMPLETE or USE_ONLY_LAST_VAD_SEGMENT:
self._clear()
logger.debug(f"End of Turn result: {state}")
return state