nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy
User-turn stop strategy for a segmented STT service.
Module Contents
Classes
API
Bases: SpeechTimeoutUserTurnStopStrategy
Speech-timeout stop strategy that keeps the user turn open until every speech segment is transcribed.
A segmented STT service such as NemoSpeechLMSTTService transcribes each VAD segment after the segment’s
VADUserStoppedSpeakingFrame. A user who pauses mid-utterance for longer than vad.stop_secs produces two
segments in one turn, and the second segment’s transcript arrives after its VAD stop.
Pipecat’s SpeechTimeoutUserTurnStopStrategy waits for that transcript through one “finalized” flag per turn,
which the first segment’s transcript can leave set. VAD frames are system frames, so the second segment’s VAD
start can overtake the first transcript on the way to the aggregator and clear the flag before that transcript
sets it again. The turn then ends at the second VAD stop, and the second transcript lands in the next user turn.
This strategy counts segments instead: one per VAD stop, cleared by the STTSegmentDoneFrame that the STT
service pushes after each segment, whether the transcription had text, came back empty, or failed. The count does
not depend on the order in which VAD frames and transcripts arrive. While a segment is pending, the turn is held,
and the frame that clears the last pending segment ends it. pending_transcript_timeout is a backstop for a
segment that does not finish in time: the strategy gives up on it that many seconds after the latest VAD stop, and
ignores its done frame if it finishes later.
Use it only with an STT service that pushes one STTSegmentDoneFrame per VAD stop, and only when the turn’s
text comes from those transcripts. An omni LLM hears the audio itself, and UserAudioBuffer consumes the
transcripts before the aggregator, so its turn has no reason to wait for them.
Cleanup the strategy.
Ready the strategy to detect the end of the turn now starting.
Clear per-turn state once the turn has ended.
Count pending segments, then let the speech-timeout logic run.
Parameters:
The frame to be analyzed.
Returns: ProcessFrameResult
Always returns CONTINUE so subsequent stop strategies are evaluated.
End the user turn, or hold it while a segment is still being transcribed.