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, wait_for_transcript: bool = True, **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, wait_for_transcript: bool = True, **kwargs)[source]
Initialize the user turn stop strategy.
- Parameters:
turn_analyzer – The turn detection analyzer instance to detect end of user turn.
wait_for_transcript – Whether to require a transcript before triggering end-of-turn. When True (default), turn-end fires only after the turn analyzer reports COMPLETE and either a finalized transcript arrives or the STT safety-net timeout elapses with text in hand. When False, the strategy signals turn-end as soon as the turn analyzer reports COMPLETE — independent of transcripts. Set this to False when local turn detection is the intended driver of the conversation (e.g. with a realtime LLM service consuming audio directly), so transcripts are off the latency critical path.
LLMContextAggregatorPairflips this for you whenrealtime_service_mode=True.**kwargs – Additional keyword arguments.
- property wait_for_transcript: bool
Whether transcripts gate end-of-turn signalling.
- 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.