> This page is for version Nightly (default).
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/labs-voice-agent/nightly/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/labs-voice-agent/llms.txt.

# nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy

User-turn stop strategy for a segmented STT service.

## Module Contents

### Classes

| Name                                                                                                                                         | Description                                                                                           |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [`SegmentedSTTUserTurnStopStrategy`](#nemo_voice_agent-pipecat-turns-segmented_stt_user_turn_stop_strategy-SegmentedSTTUserTurnStopStrategy) | Speech-timeout stop strategy that keeps the user turn open until every speech segment is transcribed. |

### API

```python
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`**

---

**`_pending_segments`**

---

**`_pending_timeout_task`**

---

```python
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy._cancel_pending_timeout()
```

async

```python
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy._pending_timeout_handler()
```

async

```python
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy._restart_pending_timeout()
```

async

```python
nemo_voice_agent.pipecat.turns.segmented_stt_user_turn_stop_strategy.SegmentedSTTUserTurnStopStrategy.cleanup()
```

async

Cleanup the strategy.

```python
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.

```python
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.

```python
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`**

The frame to be analyzed.

---

**Returns:** `ProcessFrameResult`

Always returns CONTINUE so subsequent stop strategies are evaluated.

```python
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.