Fix tests to expect SpeechControlParamsFrame from default turn strategy

This commit is contained in:
Aleix Conchillo Flaqué
2026-04-02 12:03:45 -07:00
parent 34aa37f395
commit 976c644f90

View File

@@ -28,6 +28,7 @@ from pipecat.frames.frames import (
LLMThoughtEndFrame, LLMThoughtEndFrame,
LLMThoughtStartFrame, LLMThoughtStartFrame,
LLMThoughtTextFrame, LLMThoughtTextFrame,
SpeechControlParamsFrame,
StartFrame, StartFrame,
TextFrame, TextFrame,
TranscriptionFrame, TranscriptionFrame,
@@ -67,7 +68,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
pipeline = Pipeline([LLMUserAggregator(context)]) pipeline = Pipeline([LLMUserAggregator(context)])
frames_to_send = [LLMRunFrame()] frames_to_send = [LLMRunFrame()]
expected_down_frames = [LLMContextFrame] expected_down_frames = [SpeechControlParamsFrame, LLMContextFrame]
await run_test( await run_test(
pipeline, pipeline,
frames_to_send=frames_to_send, frames_to_send=frames_to_send,
@@ -110,7 +111,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
run_llm=True, run_llm=True,
) )
] ]
expected_down_frames = [LLMContextFrame] expected_down_frames = [SpeechControlParamsFrame, LLMContextFrame]
await run_test( await run_test(
pipeline, pipeline,
frames_to_send=frames_to_send, frames_to_send=frames_to_send,
@@ -450,7 +451,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
(down_frames, _) = await run_test( (down_frames, _) = await run_test(
pipeline, pipeline,
frames_to_send=[], frames_to_send=[],
expected_down_frames=[StartFrame, UserMuteStartedFrame], expected_down_frames=[StartFrame, UserMuteStartedFrame, SpeechControlParamsFrame],
ignore_start=False, ignore_start=False,
) )
@@ -467,6 +468,7 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
# TranscriptionUserTurnStartStrategy, so we expect turn-related frames # TranscriptionUserTurnStartStrategy, so we expect turn-related frames
# but NOT the InterimTranscriptionFrame itself. # but NOT the InterimTranscriptionFrame itself.
expected_down_frames = [ expected_down_frames = [
SpeechControlParamsFrame,
UserStartedSpeakingFrame, UserStartedSpeakingFrame,
InterruptionFrame, InterruptionFrame,
] ]
@@ -485,11 +487,12 @@ class TestLLMUserAggregator(unittest.IsolatedAsyncioTestCase):
frames_to_send = [ frames_to_send = [
TranslationFrame(text="Hola!", user_id="", timestamp="now", language="es"), TranslationFrame(text="Hola!", user_id="", timestamp="now", language="es"),
] ]
# No downstream frames expected — translations are consumed. # Only the SpeechControlParamsFrame from the default turn strategy on
# start is expected — the translation itself is consumed.
await run_test( await run_test(
pipeline, pipeline,
frames_to_send=frames_to_send, frames_to_send=frames_to_send,
expected_down_frames=[], expected_down_frames=[SpeechControlParamsFrame],
) )