Skip to navigation

Submodules

Package Contents

Classes

NameDescription
SegmentedSTTUserTurnStopStrategySpeech-timeout stop strategy that keeps the user turn open until every speech segment is transcribed.

API

class nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy(
pending_transcript_timeout: float = 10.0,
kwargs = {}
)

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.

_abandoned_segments
= 0
_pending_segments
= 0
_pending_timeout_task
Optional[Task] = None
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy._cancel_pending_timeout()
async
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy._pending_timeout_handler()
async
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy._restart_pending_timeout()
async
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy.cleanup()
async

Cleanup the strategy.

nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy.handle_user_turn_started()
async

Ready the strategy to detect the end of the turn now starting.

nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy.handle_user_turn_stopped()
async

Clear per-turn state once the turn has ended.

nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy.process_frame(
frame: pipecat.frames.frames.Frame
) -> pipecat.turns.types.ProcessFrameResult
async

Count pending segments, then let the speech-timeout logic run.

Parameters:

frame
Frame

The frame to be analyzed.

Returns: ProcessFrameResult

Always returns CONTINUE so subsequent stop strategies are evaluated.

nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy.trigger_user_turn_stopped()
async

End the user turn, or hold it while a segment is still being transcribed.