frames: add turn start strategies to StartFrame

This commit is contained in:
Aleix Conchillo Flaqué
2025-11-12 15:26:57 -08:00
parent 76c79a7dfa
commit 5dd3af25ac
2 changed files with 33 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ from pipecat.utils.utils import obj_count, obj_id
if TYPE_CHECKING:
from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage, NotGiven
from pipecat.processors.frame_processor import FrameProcessor
from pipecat.turns.turn_start_strategies import TurnStartStrategies
class DeprecatedKeypadEntry:
@@ -959,6 +960,7 @@ class StartFrame(SystemFrame):
enable_tracing: bool = False
enable_usage_metrics: bool = False
interruption_strategies: List[BaseInterruptionStrategy] = field(default_factory=list)
turn_start_strategies: Optional["TurnStartStrategies"] = None
report_only_initial_ttfb: bool = False

View File

@@ -0,0 +1,31 @@
#
# Copyright (c) 20242025, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
"""Turn start strategy configuration."""
from dataclasses import dataclass
from typing import List
from pipecat.turns.bot.base_bot_turn_start_strategy import BaseBotTurnStartStrategy
from pipecat.turns.user.base_user_turn_start_strategy import BaseUserTurnStartStrategy
@dataclass
class TurnStartStrategies:
"""Container for user and bot turn start strategies.
This class groups the configured turn start strategies for both the user
and the bot.
Attributes:
user: A list of user turn start strategies used to detect when the
user starts speaking.
bot: A list of bot turn start strategies used to decide when the bot
should start speaking.
"""
user: List[BaseUserTurnStartStrategy]
bot: List[BaseBotTurnStartStrategy]