Rename UserTurnCompletedFrame to UserTurnInferenceCompletedFrame
The old name overlapped semantically with `UserStoppedSpeakingFrame`: both could be read as "the user's turn is done." They're at different layers — `UserStoppedSpeakingFrame` is the acoustic stop signal, while this frame is the post-judgment "inference about the turn is now complete (turn is semantically final)" signal emitted by the LLM mixin (on ✓), an end-of-turn classifier, or a custom producer. The new name pairs naturally with the existing `on_user_turn_inference_triggered` event vocabulary and removes the ambiguity with `UserStoppedSpeakingFrame`.
This commit is contained in:
@@ -570,7 +570,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
async def test_inference_triggered_event_fires_on_default_strategies(self):
|
||||
"""Default flow fires inference-triggered before stopped, both with the same strategy."""
|
||||
from pipecat.frames.frames import UserTurnCompletedFrame # noqa: F401
|
||||
from pipecat.frames.frames import UserTurnInferenceCompletedFrame # noqa: F401
|
||||
|
||||
context = LLMContext()
|
||||
user_aggregator = LLMUserAggregator(
|
||||
@@ -649,8 +649,8 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertIsInstance(stop_strategies[1], LLMTurnCompletionUserTurnStopStrategy)
|
||||
|
||||
async def test_llm_completion_strategy_finalizes_on_complete_marker(self):
|
||||
"""LLMTurnCompletionUserTurnStopStrategy finalizes only on UserTurnCompletedFrame(complete)."""
|
||||
from pipecat.frames.frames import UserTurnCompletedFrame
|
||||
"""LLMTurnCompletionUserTurnStopStrategy finalizes only on UserTurnInferenceCompletedFrame(complete)."""
|
||||
from pipecat.frames.frames import UserTurnInferenceCompletedFrame
|
||||
from pipecat.turns.user_stop import LLMTurnCompletionUserTurnStopStrategy, deferred
|
||||
|
||||
gating = LLMTurnCompletionUserTurnStopStrategy()
|
||||
@@ -678,7 +678,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
|
||||
pipeline = Pipeline([user_aggregator])
|
||||
|
||||
# Drive the pipeline. Inference fires after the upstream
|
||||
# strategy's timeout. Stop fires only when UserTurnCompletedFrame
|
||||
# strategy's timeout. Stop fires only when UserTurnInferenceCompletedFrame
|
||||
# arrives (producer absence == "not yet complete").
|
||||
frames_to_send = [
|
||||
VADUserStartedSpeakingFrame(),
|
||||
@@ -687,7 +687,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
|
||||
VADUserStoppedSpeakingFrame(),
|
||||
SleepFrame(sleep=TRANSCRIPTION_TIMEOUT + 0.1),
|
||||
# At this point inference_triggered should have fired but NOT stopped.
|
||||
UserTurnCompletedFrame(),
|
||||
UserTurnInferenceCompletedFrame(),
|
||||
SleepFrame(),
|
||||
]
|
||||
await run_test(pipeline, frames_to_send=frames_to_send)
|
||||
@@ -703,7 +703,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
|
||||
and the conversation context should reflect the full user
|
||||
utterance, not just the segment from the last inference.
|
||||
"""
|
||||
from pipecat.frames.frames import UserTurnCompletedFrame
|
||||
from pipecat.frames.frames import UserTurnInferenceCompletedFrame
|
||||
from pipecat.turns.user_stop import LLMTurnCompletionUserTurnStopStrategy, deferred
|
||||
|
||||
gating = LLMTurnCompletionUserTurnStopStrategy()
|
||||
@@ -747,8 +747,8 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
|
||||
VADUserStoppedSpeakingFrame(),
|
||||
SleepFrame(sleep=TRANSCRIPTION_TIMEOUT + 0.1),
|
||||
# Second inference fired here. Now the LLM returns ✓ and the
|
||||
# turn finalizes via UserTurnCompletedFrame.
|
||||
UserTurnCompletedFrame(),
|
||||
# turn finalizes via UserTurnInferenceCompletedFrame.
|
||||
UserTurnInferenceCompletedFrame(),
|
||||
SleepFrame(),
|
||||
]
|
||||
await run_test(pipeline, frames_to_send=frames_to_send)
|
||||
|
||||
@@ -12,7 +12,7 @@ from pipecat.frames.frames import (
|
||||
LLMFullResponseEndFrame,
|
||||
LLMMarkerFrame,
|
||||
LLMTextFrame,
|
||||
UserTurnCompletedFrame,
|
||||
UserTurnInferenceCompletedFrame,
|
||||
)
|
||||
from pipecat.processors.frame_processor import FrameProcessor
|
||||
from pipecat.services.llm_service import LLMService
|
||||
@@ -61,8 +61,8 @@ class TestUserUserTurnCompletionLLMServiceMixin(unittest.IsolatedAsyncioTestCase
|
||||
self.assertEqual(marker_frames[0].marker, USER_TURN_COMPLETE_MARKER)
|
||||
self.assertFalse(marker_frames[0].append_to_context_immediately)
|
||||
|
||||
# UserTurnCompletedFrame broadcast in both directions.
|
||||
completed = [f for f in pushed_frames if isinstance(f, UserTurnCompletedFrame)]
|
||||
# UserTurnInferenceCompletedFrame broadcast in both directions.
|
||||
completed = [f for f in pushed_frames if isinstance(f, UserTurnInferenceCompletedFrame)]
|
||||
self.assertEqual(len(completed), 2)
|
||||
|
||||
async def test_incomplete_short_marker_suppresses_text(self):
|
||||
@@ -87,8 +87,8 @@ class TestUserUserTurnCompletionLLMServiceMixin(unittest.IsolatedAsyncioTestCase
|
||||
self.assertEqual(marker_frames[0].marker, USER_TURN_INCOMPLETE_SHORT_MARKER)
|
||||
self.assertTrue(marker_frames[0].append_to_context_immediately)
|
||||
|
||||
# Incomplete markers do not emit UserTurnCompletedFrame.
|
||||
completed = [f for f in pushed_frames if isinstance(f, UserTurnCompletedFrame)]
|
||||
# Incomplete markers do not emit UserTurnInferenceCompletedFrame.
|
||||
completed = [f for f in pushed_frames if isinstance(f, UserTurnInferenceCompletedFrame)]
|
||||
self.assertEqual(len(completed), 0)
|
||||
|
||||
async def test_incomplete_long_marker_suppresses_text(self):
|
||||
@@ -112,7 +112,7 @@ class TestUserUserTurnCompletionLLMServiceMixin(unittest.IsolatedAsyncioTestCase
|
||||
self.assertEqual(marker_frames[0].marker, USER_TURN_INCOMPLETE_LONG_MARKER)
|
||||
self.assertTrue(marker_frames[0].append_to_context_immediately)
|
||||
|
||||
completed = [f for f in pushed_frames if isinstance(f, UserTurnCompletedFrame)]
|
||||
completed = [f for f in pushed_frames if isinstance(f, UserTurnInferenceCompletedFrame)]
|
||||
self.assertEqual(len(completed), 0)
|
||||
|
||||
async def test_text_buffered_until_marker_found(self):
|
||||
@@ -135,7 +135,7 @@ class TestUserUserTurnCompletionLLMServiceMixin(unittest.IsolatedAsyncioTestCase
|
||||
await processor._push_turn_text(f" {USER_TURN_COMPLETE_MARKER} How are you?")
|
||||
|
||||
# One LLMTextFrame for the spoken portion; one LLMMarkerFrame for
|
||||
# the marker; UserTurnCompletedFrame broadcast in both directions.
|
||||
# the marker; UserTurnInferenceCompletedFrame broadcast in both directions.
|
||||
text_frames = [f for f in pushed_frames if isinstance(f, LLMTextFrame)]
|
||||
self.assertEqual(len(text_frames), 1)
|
||||
marker_frames = [f for f in pushed_frames if isinstance(f, LLMMarkerFrame)]
|
||||
|
||||
Reference in New Issue
Block a user