Test LLMAssistantAggregator handling of upstream message frames

Add tests for LLMRunFrame, LLMMessagesAppendFrame, LLMMessagesUpdateFrame,
and LLMMessagesTransformFrame sent upstream to LLMAssistantAggregator,
mirroring the existing LLMUserAggregator downstream tests. Add
frames_to_send_direction param to run_test helper to support this.
This commit is contained in:
Paul Kompfner
2026-04-02 18:34:35 -04:00
parent 4eebfd65d9
commit 6111df947e
2 changed files with 146 additions and 1 deletions

View File

@@ -127,6 +127,7 @@ async def run_test(
expected_down_frames: Optional[Sequence[type]] = None,
expected_up_frames: Optional[Sequence[type]] = None,
frames_to_send: Sequence[Frame],
frames_to_send_direction: FrameDirection = FrameDirection.DOWNSTREAM,
ignore_start: bool = True,
observers: Optional[List[BaseObserver]] = None,
pipeline_params: Optional[PipelineParams] = None,
@@ -144,6 +145,9 @@ async def run_test(
expected_down_frames: Expected frame types flowing downstream (optional).
expected_up_frames: Expected frame types flowing upstream (optional).
frames_to_send: Sequence of frames to send through the processor.
frames_to_send_direction: Direction to send frames_to_send. Downstream
frames are pushed from the beginning of the pipeline, upstream frames
from the end. Defaults to DOWNSTREAM.
ignore_start: Whether to ignore StartFrames in frame validation.
observers: Optional list of observers to attach to the pipeline.
pipeline_params: Optional pipeline parameters.
@@ -188,7 +192,7 @@ async def run_test(
if isinstance(frame, SleepFrame):
await asyncio.sleep(frame.sleep)
else:
await task.queue_frame(frame)
await task.queue_frame(frame, frames_to_send_direction)
if send_end_frame:
await task.queue_frame(EndFrame())