turns: rename bot turn start to user turn stop strategies

This commit is contained in:
Aleix Conchillo Flaqué
2025-12-30 14:09:00 -08:00
parent fb9a772e33
commit eb5a797b12
161 changed files with 921 additions and 891 deletions

View File

@@ -1,10 +1,10 @@
- Introducing user and bot turn start strategies. Turn start strategies indicate when user and bot turns begin. In conversational agents, these are often referred to as start/stop speaking or turn-taking plans or policies.
- Introducing user turn strategies. User turn strategies indicate when the user turn starts or stops. In conversational agents, these are often referred to as start/stop speaking or turn-taking plans or policies.
User turn start strategies indicate when the user starts speaking (e.g. using VAD events or when a user says one or more words).
Bot turn start strategies indicate when the bot should start speaking (e.g. using an end-of-turn detection model or by observing incoming transcriptions).
User turn stop strategies indicate when the user stops speaking (e.g. using an end-of-turn detection model or by observing incoming transcriptions).
A list of strategies can be specified for both the user and the bot; strategies are evaluated in order until one evaluates to true.
A list of strategies can be specified for both strategies; strategies are evaluated in order until one evaluates to true.
Available user turn start strategies:
- VADUserTurnStartStrategy
@@ -12,25 +12,25 @@
- MinWordsUserTurnStartStrategy
- ExternalUserTurnStartStrategy
Available bot turn start strategies:
- TranscriptionBotTurnStartStrategy
- TurnAnalyzerBotTurnStartStrategy
- ExternalBotTurnStartStrategy
Available user turn stop strategies:
- TranscriptionUserTurnStopStrategy
- TurnAnalyzerUserTurnStopStrategy
- ExternalUserTurnStopStrategy
The default strategies are:
- user: [VADUserTurnStartStrategy, TranscriptionUserTurnStartStrategy]
- bot: [TranscriptionBotTurnStartStrategy]
- start: [VADUserTurnStartStrategy, TranscriptionUserTurnStartStrategy]
- stop: [TranscriptionUserTurnStopStrategy]
Turn start strategies are configured when setting up `LLMContextAggregatorPair`. For example:
Turn strategies are configured when setting up `LLMContextAggregatorPair`. For example:
```python
context_aggregator = LLMContextAggregatorPair(
context,
user_params=LLMUserAggregatorParams(
turn_start_strategies=TurnStartStrategies(
bot=[
TurnAnalyzerBotTurnStartStrategy(
user_turn_strategies=UserTurnStrategies(
stop=[
TurnAnalyzerUserTurnStopStrategy(
turn_analyzer=LocalSmartTurnAnalyzerV3(params=SmartTurnParams())
)
],
@@ -39,4 +39,4 @@
)
```
In order to use the turn start strategies you should update to the new universal `LLMContext` and `LLMContextAggregatorPair`.
In order to use the user turn strategies you must update to the new universal `LLMContext` and `LLMContextAggregatorPair`.

View File

@@ -1 +1 @@
- `pipecat.audio.interruptions.MinWordsInterruptionStrategy` is deprecated. Use `pipecat.turns.user.MinWordsUserTurnStartStrategy` with `LLMUserAggregator`'s new `turn_start_strategies` parameter instead.
- `pipecat.audio.interruptions.MinWordsInterruptionStrategy` is deprecated. Use `pipecat.turns.user_start.MinWordsUserTurnStartStrategy` with `LLMUserAggregator`'s new `turn_start_strategies` parameter instead.

View File

@@ -1,4 +1,4 @@
- `LLMUserAggregator` now exposes the following events:
- `on_user_turn_started`: triggered when a user turn starts
- `on_bot_turn_started`: triggered when a user turn ends and a bot turn starts
- `on_user_turn_end_timeout`: triggered when a user turn does not stop and times out
- `on_user_turn_stopped`: triggered when a user turn ends
- `on_user_turn_stop_timeout`: triggered when a user turn does not stop and times out

View File

@@ -4,8 +4,8 @@
context_aggregator = LLMContextAggregatorPair(
context,
user_params=LLMUserAggregatorParams(
turn_start_strategies=TurnStartStrategies(
user=[TranscriptionUserTurnStartStrategy(enable_interruptions=False)],
user_turn_strategies=UserTurnStrategies(
start=[TranscriptionUserTurnStartStrategy(enable_interruptions=False)],
),
),
)