Skip to content

User Turn silently skipped when STT results arrives later than VAD #4279

@anotine10

Description

@anotine10

I am debugging specific issue:

  • Deepgram STT flux outputs results later than expected.
  • TUrn is already stopped as VAD is not detecting any activity (and it is stopped with content='' as deepgram has not output any transcription yet)
  • When Deepgram finally outputs the final transcript, The _trigger_user_turn_stop triggered with the External Strategy is silently exiting because use_turn is already false.

https://github.com/pipecat-ai/pipecat/blame/e248c4c04905fd986bec8e793a55791b0f7698bc/src/pipecat/turns/user_turn_controller.py#L282

 async def _trigger_user_turn_stop(self, strategy, params):
      # Prevent two consecutive user turn stops.
      if not self._user_turn:
          return   # ← SILENTLY EXITS
      ...
      await self._call_event_handler("on_user_turn_stopped", strategy, params)

@markbackman , is there any good reason to not remove this condition?

To force reproduction:
i have put:

deepgram_params = DeepgramFluxSTTService.InputParams(
                eager_eot_threshold=0.5,  # default None
                eot_threshold=0.8,  # default 0.7
                eot_timeout_ms=6000,  # Maximum silence duration (ms) before forcing EndOfTurn, default 5000
                min_confidence=0.5,  # default 0.3
            )

user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
            context,
            user_params=LLMUserAggregatorParams(
                user_turn_strategies=turn_strategies,
                user_mute_strategies=mute_strategies,
                vad_analyzer=vad_analyzer,
                user_idle_timeout=user_idle_timeout,
                user_turn_stop_timeout=2, << less than 6000
            ),
            assistant_params=LLMAssistantAggregatorParams(expect_stripped_words=True),
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions