diff --git a/src/pipecat/audio/turn/base_turn_analyzer.py b/src/pipecat/audio/turn/base_turn_analyzer.py index fd4f18d66..301dbf7bf 100644 --- a/src/pipecat/audio/turn/base_turn_analyzer.py +++ b/src/pipecat/audio/turn/base_turn_analyzer.py @@ -78,3 +78,8 @@ class BaseTurnAnalyzer(ABC): EndOfTurnState: The result of the end of turn analysis. """ pass + + @abstractmethod + def clear(self): + """Reset the turn analyzer to its initial state.""" + pass diff --git a/src/pipecat/audio/turn/smart_turn/base_smart_turn.py b/src/pipecat/audio/turn/smart_turn/base_smart_turn.py index 1bd187aee..0b577028b 100644 --- a/src/pipecat/audio/turn/smart_turn/base_smart_turn.py +++ b/src/pipecat/audio/turn/smart_turn/base_smart_turn.py @@ -98,6 +98,9 @@ class BaseSmartTurn(BaseTurnAnalyzer): logger.debug(f"End of Turn result: {state}") return state, result + def clear(self): + self._clear(EndOfTurnState.COMPLETE) + def _clear(self, turn_state: EndOfTurnState): # If the state is still incomplete, keep the _speech_triggered as True self._speech_triggered = turn_state == EndOfTurnState.INCOMPLETE