diff --git a/pyrightconfig.json b/pyrightconfig.json index ea03dc37b..4016fd6e9 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -8,7 +8,8 @@ "src/pipecat/transcriptions", "src/pipecat/frames", "src/pipecat/observers", - "src/pipecat/extensions" + "src/pipecat/extensions", + "src/pipecat/turns" ], "exclude": [ "**/*_pb2.py", diff --git a/src/pipecat/turns/user_start/base_user_turn_start_strategy.py b/src/pipecat/turns/user_start/base_user_turn_start_strategy.py index 401178cc7..b424d7a9e 100644 --- a/src/pipecat/turns/user_start/base_user_turn_start_strategy.py +++ b/src/pipecat/turns/user_start/base_user_turn_start_strategy.py @@ -101,7 +101,7 @@ class BaseUserTurnStartStrategy(BaseObject): """Reset the strategy to its initial state.""" pass - async def process_frame(self, frame: Frame) -> ProcessFrameResult: + async def process_frame(self, frame: Frame) -> ProcessFrameResult | None: """Process an incoming frame. Subclasses should override this to implement logic that decides whether @@ -111,8 +111,8 @@ class BaseUserTurnStartStrategy(BaseObject): frame: The frame to be processed. Returns: - A ProcessFrameResult indicating the outcome. Subclasses that return - None are treated as CONTINUE for backward compatibility. + A ProcessFrameResult indicating the outcome, or None (treated as + CONTINUE for backward compatibility). """ pass diff --git a/src/pipecat/turns/user_stop/base_user_turn_stop_strategy.py b/src/pipecat/turns/user_stop/base_user_turn_stop_strategy.py index 1f8497359..e5dc1bd66 100644 --- a/src/pipecat/turns/user_stop/base_user_turn_stop_strategy.py +++ b/src/pipecat/turns/user_stop/base_user_turn_stop_strategy.py @@ -89,7 +89,7 @@ class BaseUserTurnStopStrategy(BaseObject): """Reset the strategy to its initial state.""" pass - async def process_frame(self, frame: Frame) -> ProcessFrameResult: + async def process_frame(self, frame: Frame) -> ProcessFrameResult | None: """Process an incoming frame to decide whether the user stopped speaking. Subclasses should override this to implement logic that decides whether @@ -99,8 +99,8 @@ class BaseUserTurnStopStrategy(BaseObject): frame: The frame to be analyzed. Returns: - A ProcessFrameResult indicating the outcome. Subclasses that return - None are treated as CONTINUE for backward compatibility. + A ProcessFrameResult indicating the outcome, or None (treated as + CONTINUE for backward compatibility). """ pass diff --git a/src/pipecat/turns/user_turn_completion_mixin.py b/src/pipecat/turns/user_turn_completion_mixin.py index ab5397c06..51d6c7828 100644 --- a/src/pipecat/turns/user_turn_completion_mixin.py +++ b/src/pipecat/turns/user_turn_completion_mixin.py @@ -26,7 +26,7 @@ from pipecat.frames.frames import ( LLMRunFrame, LLMTextFrame, ) -from pipecat.processors.frame_processor import FrameDirection +from pipecat.processors.frame_processor import FrameDirection, FrameProcessor # Turn completion markers USER_TURN_COMPLETE_MARKER = "✓" @@ -178,7 +178,7 @@ class UserTurnCompletionConfig: return self.incomplete_long_prompt or DEFAULT_INCOMPLETE_LONG_PROMPT -class UserTurnCompletionLLMServiceMixin: +class UserTurnCompletionLLMServiceMixin(FrameProcessor): """Mixin that adds turn completion detection to LLM services. This mixin provides methods to push LLM text with turn completion detection.