diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index 489fd53ad..03ad7d41b 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -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 diff --git a/src/pipecat/turns/turn_start_strategies.py b/src/pipecat/turns/turn_start_strategies.py new file mode 100644 index 000000000..a3a344ef3 --- /dev/null +++ b/src/pipecat/turns/turn_start_strategies.py @@ -0,0 +1,31 @@ +# +# Copyright (c) 2024–2025, 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]