turn_analyzer_user_turn_stop_strategy
User turn stop strategy based on turn detection analyzers.
- class pipecat.turns.user_stop.turn_analyzer_user_turn_stop_strategy.TurnAnalyzerUserTurnStopStrategy(*, turn_analyzer: BaseTurnAnalyzer, **kwargs)[source]
Bases:
BaseUserTurnStopStrategyUser turn stop strategy that uses a turn detection model to determine if the user is done speaking.
This strategy feeds audio, VAD, and transcription frames to a turn detection model (
BaseTurnAnalyzer) that predicts when the user has finished their turn. Once the model indicates the turn is complete, the strategy waits for a final transcription before triggering the end of the user’s turn.For services that support finalization (TranscriptionFrame.finalized=True), the turn can be triggered immediately once the finalized transcript is received. Otherwise, an STT timeout (adjusted by VAD stop_secs) is used as a fallback.
- __init__(*, turn_analyzer: BaseTurnAnalyzer, **kwargs)[source]
Initialize the user turn stop strategy.
- Parameters:
turn_analyzer – The turn detection analyzer instance to detect end of user turn.
**kwargs – Additional keyword arguments.
- async setup(task_manager: BaseTaskManager)[source]
Initialize the strategy with the given task manager.
- Parameters:
task_manager – The task manager to be associated with this instance.
- async process_frame(frame: Frame) ProcessFrameResult[source]
Process an incoming frame to update the turn analyzer and strategy state.
- Parameters:
frame – The frame to be analyzed.
- Returns:
Always returns CONTINUE so subsequent stop strategies are evaluated.