mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-13 08:15:21 +02:00
chore: update pipecat to 1.3.0 (#379)
* chore: rename PipelineTask to PipelineWorker * fix: fix tests * chore: update pipecat submodule * fix: fix anyio same task cancellation scope
This commit is contained in:
parent
e695436fb3
commit
5ef3be92b5
26 changed files with 170 additions and 132 deletions
|
|
@ -15,7 +15,7 @@ Provided here:
|
|||
- ``NoopFeedbackObserver``: a ``RealtimeFeedbackObserver`` stand-in with
|
||||
no WebSocket / clock-task side effects.
|
||||
- ``patch_run_pipeline_externals``: ``contextmanager`` that applies the
|
||||
full patch set and captures the constructed ``PipelineTask`` for the
|
||||
full patch set and captures the constructed ``PipelineWorker`` for the
|
||||
caller. Optional ``llm`` / ``tts`` arguments inject preconfigured
|
||||
mocks; otherwise blank ``MockLLMService`` / ``MockTTSService``
|
||||
instances are constructed per-call.
|
||||
|
|
@ -84,10 +84,10 @@ def patch_run_pipeline_externals(
|
|||
tts: MockTTSService | None = None,
|
||||
):
|
||||
"""Patch the externally-talking pieces of ``_run_pipeline`` and capture
|
||||
the constructed ``PipelineTask`` so tests can drive it from outside.
|
||||
the constructed ``PipelineWorker`` so tests can drive it from outside.
|
||||
|
||||
Args:
|
||||
captured_task: A list the constructed ``PipelineTask`` is appended
|
||||
captured_task: A list the constructed ``PipelineWorker`` is appended
|
||||
to. Tests read ``captured_task[0]`` to get a handle on the task
|
||||
(to wait on its start event, queue frames, cancel it, etc.).
|
||||
llm: Optional pre-built ``MockLLMService``. When given, every call
|
||||
|
|
@ -168,7 +168,7 @@ def patch_run_pipeline_externals(
|
|||
return_value="completed",
|
||||
)
|
||||
)
|
||||
# Capture the PipelineTask so the test can drive it from outside.
|
||||
# Capture the PipelineWorker so the test can drive it from outside.
|
||||
stack.enter_context(
|
||||
patch(
|
||||
"api.services.pipecat.run_pipeline.create_pipeline_task",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Drives the actual ``_run_pipeline`` against the test database with real
|
||||
DB rows (organization, user, user configuration, workflow, workflow run)
|
||||
and pipecat's real ``MockTransport`` / ``Pipeline`` / ``PipelineTask``.
|
||||
and pipecat's real ``MockTransport`` / ``Pipeline`` / ``PipelineWorker``.
|
||||
The only patches are for things that talk to genuinely external systems;
|
||||
those are applied via ``patch_run_pipeline_externals`` from the shared
|
||||
helpers module.
|
||||
|
|
@ -23,6 +23,7 @@ from pipecat.transports.base_transport import TransportParams
|
|||
from api.enums import WorkflowRunMode, WorkflowRunState
|
||||
from api.services.pipecat.audio_config import create_audio_config
|
||||
from api.services.pipecat.run_pipeline import _run_pipeline
|
||||
from api.services.pipecat.worker_runner import wait_for_pipeline_worker_started
|
||||
from api.tests.integrations._run_pipeline_helpers import (
|
||||
create_workflow_run_rows,
|
||||
patch_run_pipeline_externals,
|
||||
|
|
@ -116,7 +117,9 @@ async def test_run_pipeline_fires_initial_response_and_completes_run(
|
|||
run_task.result() # re-raise the failure
|
||||
assert captured_task, "create_pipeline_task was never invoked"
|
||||
pipeline_task = captured_task[0]
|
||||
await asyncio.wait_for(pipeline_task._pipeline_start_event.wait(), timeout=3.0)
|
||||
await wait_for_pipeline_worker_started(
|
||||
pipeline_task, timeout=3.0, run_task=run_task
|
||||
)
|
||||
# Let the initial response handler (set_node, queue LLMContextFrame)
|
||||
# complete before tearing things down.
|
||||
await asyncio.sleep(0.1)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ from pipecat.utils.time import time_now_iso8601
|
|||
from api.enums import WorkflowRunMode, WorkflowRunState
|
||||
from api.services.pipecat.audio_config import create_audio_config
|
||||
from api.services.pipecat.run_pipeline import _run_pipeline
|
||||
from api.services.pipecat.worker_runner import wait_for_pipeline_worker_started
|
||||
from api.tests.integrations._run_pipeline_helpers import (
|
||||
create_workflow_run_rows,
|
||||
patch_run_pipeline_externals,
|
||||
|
|
@ -186,12 +187,12 @@ async def _run_test_body(workflow_run_setup, db_session) -> None:
|
|||
assert captured_task, "create_pipeline_task was never invoked"
|
||||
pipeline_task = captured_task[0]
|
||||
|
||||
await asyncio.wait_for(
|
||||
pipeline_task._pipeline_start_event.wait(), timeout=3.0
|
||||
await wait_for_pipeline_worker_started(
|
||||
pipeline_task, timeout=3.0, run_task=run_task
|
||||
)
|
||||
|
||||
# Locate the assistant aggregator's LLM context (downstream of TTS).
|
||||
# The PipelineTask wraps the user's pipeline inside another Pipeline,
|
||||
# The PipelineWorker wraps the user's pipeline inside another Pipeline,
|
||||
# so we walk the tree recursively.
|
||||
assistant_aggregator = _find_processor_by_class_name(
|
||||
pipeline_task, "LLMAssistantAggregator"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue