Tighten the pipeline_task contract for processors and tools
`FrameProcessorSetup.pipeline_task` is now mandatory and `FrameProcessor.pipeline_task` raises if accessed before setup instead of returning `None`. `FunctionCallParams` gains a required `pipeline_task` field and `LLMService._run_function_call` populates it (plus reads `app_resources` directly off the pipeline task). Tests that build a processor or `FunctionCallParams` outside a real pipeline stub it with a `SimpleNamespace`.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import asyncio
|
||||
import struct
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
|
||||
from pipecat.clocks.system_clock import SystemClock
|
||||
from pipecat.frames.frames import (
|
||||
@@ -44,7 +45,13 @@ async def _make_processor(*, buffer_size: int = 0) -> AudioBufferProcessor:
|
||||
loop = asyncio.get_event_loop()
|
||||
task_manager = TaskManager()
|
||||
task_manager.setup(TaskManagerParams(loop=loop))
|
||||
await processor.setup(FrameProcessorSetup(clock=SystemClock(), task_manager=task_manager))
|
||||
await processor.setup(
|
||||
FrameProcessorSetup(
|
||||
clock=SystemClock(),
|
||||
task_manager=task_manager,
|
||||
pipeline_task=SimpleNamespace(app_resources=None), # type: ignore[arg-type]
|
||||
)
|
||||
)
|
||||
|
||||
await processor.process_frame(
|
||||
StartFrame(audio_out_sample_rate=16000), FrameDirection.DOWNSTREAM
|
||||
|
||||
Reference in New Issue
Block a user