From b860e945826aad7de1ac7acae1a9bed64e38f387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 25 Jun 2025 22:03:13 -0700 Subject: [PATCH] move things to new utils.asyncio package --- src/pipecat/pipeline/parallel_pipeline.py | 2 +- src/pipecat/pipeline/sync_parallel_pipeline.py | 2 +- src/pipecat/pipeline/task.py | 11 ++++++++--- src/pipecat/pipeline/task_observer.py | 6 +++--- src/pipecat/processors/consumer_processor.py | 2 +- src/pipecat/processors/frame_processor.py | 8 ++++---- src/pipecat/processors/frameworks/rtvi.py | 2 +- .../processors/metrics/frame_processor_metrics.py | 2 +- src/pipecat/processors/metrics/sentry.py | 6 +++--- src/pipecat/processors/producer_processor.py | 2 +- src/pipecat/services/anthropic/llm.py | 2 +- src/pipecat/services/cartesia/tts.py | 2 +- src/pipecat/services/elevenlabs/tts.py | 2 +- src/pipecat/services/gemini_multimodal_live/gemini.py | 2 +- src/pipecat/services/gladia/stt.py | 2 +- src/pipecat/services/google/llm.py | 2 +- src/pipecat/services/google/llm_openai.py | 2 +- src/pipecat/services/google/stt.py | 2 +- src/pipecat/services/neuphonic/tts.py | 2 +- src/pipecat/services/openai/base_llm.py | 2 +- src/pipecat/services/openai_realtime_beta/openai.py | 2 +- src/pipecat/services/riva/stt.py | 2 +- src/pipecat/services/sambanova/llm.py | 2 +- src/pipecat/services/simli/video.py | 2 +- src/pipecat/services/tavus/video.py | 2 +- src/pipecat/services/tts_service.py | 2 +- src/pipecat/transports/base_output.py | 2 +- src/pipecat/transports/network/fastapi_websocket.py | 2 +- src/pipecat/transports/network/small_webrtc.py | 2 +- src/pipecat/transports/network/websocket_client.py | 2 +- src/pipecat/transports/services/daily.py | 6 +++--- src/pipecat/transports/services/livekit.py | 4 ++-- src/pipecat/utils/asyncio/__init__.py | 0 .../utils/{asyncio.py => asyncio/task_manager.py} | 0 .../utils/{ => asyncio}/watchdog_async_iterator.py | 2 +- src/pipecat/utils/{ => asyncio}/watchdog_event.py | 2 +- .../utils/{ => asyncio}/watchdog_priority_queue.py | 2 +- src/pipecat/utils/{ => asyncio}/watchdog_queue.py | 2 +- src/pipecat/utils/{ => asyncio}/watchdog_reseter.py | 0 39 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 src/pipecat/utils/asyncio/__init__.py rename src/pipecat/utils/{asyncio.py => asyncio/task_manager.py} (100%) rename src/pipecat/utils/{ => asyncio}/watchdog_async_iterator.py (97%) rename src/pipecat/utils/{ => asyncio}/watchdog_event.py (94%) rename src/pipecat/utils/{ => asyncio}/watchdog_priority_queue.py (95%) rename src/pipecat/utils/{ => asyncio}/watchdog_queue.py (95%) rename src/pipecat/utils/{ => asyncio}/watchdog_reseter.py (100%) diff --git a/src/pipecat/pipeline/parallel_pipeline.py b/src/pipecat/pipeline/parallel_pipeline.py index f6ac78827..7068ed86d 100644 --- a/src/pipecat/pipeline/parallel_pipeline.py +++ b/src/pipecat/pipeline/parallel_pipeline.py @@ -21,7 +21,7 @@ from pipecat.frames.frames import ( from pipecat.pipeline.base_pipeline import BasePipeline from pipecat.pipeline.pipeline import Pipeline from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, FrameProcessorSetup -from pipecat.utils.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue class ParallelPipelineSource(FrameProcessor): diff --git a/src/pipecat/pipeline/sync_parallel_pipeline.py b/src/pipecat/pipeline/sync_parallel_pipeline.py index f78ca0de3..6b178bc1c 100644 --- a/src/pipecat/pipeline/sync_parallel_pipeline.py +++ b/src/pipecat/pipeline/sync_parallel_pipeline.py @@ -15,7 +15,7 @@ from pipecat.frames.frames import ControlFrame, EndFrame, Frame, SystemFrame from pipecat.pipeline.base_pipeline import BasePipeline from pipecat.pipeline.pipeline import Pipeline from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, FrameProcessorSetup -from pipecat.utils.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue @dataclass diff --git a/src/pipecat/pipeline/task.py b/src/pipecat/pipeline/task.py index 68b76401e..8b30d1a4e 100644 --- a/src/pipecat/pipeline/task.py +++ b/src/pipecat/pipeline/task.py @@ -38,11 +38,16 @@ from pipecat.pipeline.base_pipeline import BasePipeline from pipecat.pipeline.base_task import BasePipelineTask, PipelineTaskParams from pipecat.pipeline.task_observer import TaskObserver from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, FrameProcessorSetup -from pipecat.utils.asyncio import WATCHDOG_TIMEOUT, BaseTaskManager, TaskManager, TaskManagerParams +from pipecat.utils.asyncio.task_manager import ( + WATCHDOG_TIMEOUT, + BaseTaskManager, + TaskManager, + TaskManagerParams, +) +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter from pipecat.utils.tracing.setup import is_tracing_available from pipecat.utils.tracing.turn_trace_observer import TurnTraceObserver -from pipecat.utils.watchdog_queue import WatchdogQueue -from pipecat.utils.watchdog_reseter import WatchdogReseter HEARTBEAT_SECONDS = 1.0 HEARTBEAT_MONITOR_SECONDS = HEARTBEAT_SECONDS * 10 diff --git a/src/pipecat/pipeline/task_observer.py b/src/pipecat/pipeline/task_observer.py index 40d4ef3ed..ae4decbce 100644 --- a/src/pipecat/pipeline/task_observer.py +++ b/src/pipecat/pipeline/task_observer.py @@ -11,9 +11,9 @@ from typing import Dict, List, Optional from attr import dataclass from pipecat.observers.base_observer import BaseObserver, FramePushed -from pipecat.utils.asyncio import BaseTaskManager -from pipecat.utils.watchdog_queue import WatchdogQueue -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.task_manager import BaseTaskManager +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter @dataclass diff --git a/src/pipecat/processors/consumer_processor.py b/src/pipecat/processors/consumer_processor.py index 10cae11a3..0440a74e1 100644 --- a/src/pipecat/processors/consumer_processor.py +++ b/src/pipecat/processors/consumer_processor.py @@ -10,7 +10,7 @@ from typing import Awaitable, Callable, Optional from pipecat.frames.frames import CancelFrame, EndFrame, Frame, StartFrame from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.processors.producer_processor import ProducerProcessor, identity_transformer -from pipecat.utils.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue class ConsumerProcessor(FrameProcessor): diff --git a/src/pipecat/processors/frame_processor.py b/src/pipecat/processors/frame_processor.py index 134a69da7..260e549fa 100644 --- a/src/pipecat/processors/frame_processor.py +++ b/src/pipecat/processors/frame_processor.py @@ -29,11 +29,11 @@ from pipecat.frames.frames import ( from pipecat.metrics.metrics import LLMTokenUsage, MetricsData from pipecat.observers.base_observer import BaseObserver, FramePushed from pipecat.processors.metrics.frame_processor_metrics import FrameProcessorMetrics -from pipecat.utils.asyncio import BaseTaskManager +from pipecat.utils.asyncio.task_manager import BaseTaskManager +from pipecat.utils.asyncio.watchdog_event import WatchdogEvent +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter from pipecat.utils.base_object import BaseObject -from pipecat.utils.watchdog_event import WatchdogEvent -from pipecat.utils.watchdog_queue import WatchdogQueue -from pipecat.utils.watchdog_reseter import WatchdogReseter class FrameDirection(Enum): diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index 1646a9fa6..b379e522a 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -67,8 +67,8 @@ from pipecat.services.llm_service import ( from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue from pipecat.utils.string import match_endofsentence -from pipecat.utils.watchdog_queue import WatchdogQueue RTVI_PROTOCOL_VERSION = "0.3.0" diff --git a/src/pipecat/processors/metrics/frame_processor_metrics.py b/src/pipecat/processors/metrics/frame_processor_metrics.py index 9ee1ccdd3..ec1501122 100644 --- a/src/pipecat/processors/metrics/frame_processor_metrics.py +++ b/src/pipecat/processors/metrics/frame_processor_metrics.py @@ -18,7 +18,7 @@ from pipecat.metrics.metrics import ( TTFBMetricsData, TTSUsageMetricsData, ) -from pipecat.utils.asyncio import TaskManager +from pipecat.utils.asyncio.task_manager import TaskManager from pipecat.utils.base_object import BaseObject diff --git a/src/pipecat/processors/metrics/sentry.py b/src/pipecat/processors/metrics/sentry.py index 083ff621b..b19e9aa04 100644 --- a/src/pipecat/processors/metrics/sentry.py +++ b/src/pipecat/processors/metrics/sentry.py @@ -8,9 +8,9 @@ import asyncio from loguru import logger -from pipecat.utils.asyncio import TaskManager -from pipecat.utils.watchdog_queue import WatchdogQueue -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.task_manager import TaskManager +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter try: import sentry_sdk diff --git a/src/pipecat/processors/producer_processor.py b/src/pipecat/processors/producer_processor.py index ad08802e2..e00ac6e84 100644 --- a/src/pipecat/processors/producer_processor.py +++ b/src/pipecat/processors/producer_processor.py @@ -9,7 +9,7 @@ from typing import Awaitable, Callable, List from pipecat.frames.frames import Frame from pipecat.processors.frame_processor import FrameDirection, FrameProcessor -from pipecat.utils.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue async def identity_transformer(frame: Frame): diff --git a/src/pipecat/services/anthropic/llm.py b/src/pipecat/services/anthropic/llm.py index b5334c383..246efcf26 100644 --- a/src/pipecat/services/anthropic/llm.py +++ b/src/pipecat/services/anthropic/llm.py @@ -46,8 +46,8 @@ from pipecat.processors.aggregators.openai_llm_context import ( ) from pipecat.processors.frame_processor import FrameDirection from pipecat.services.llm_service import FunctionCallFromLLM, LLMService +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_llm -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator try: from anthropic import NOT_GIVEN, AsyncAnthropic, NotGiven diff --git a/src/pipecat/services/cartesia/tts.py b/src/pipecat/services/cartesia/tts.py index ac65db692..2309c9d8c 100644 --- a/src/pipecat/services/cartesia/tts.py +++ b/src/pipecat/services/cartesia/tts.py @@ -29,10 +29,10 @@ from pipecat.frames.frames import ( from pipecat.processors.frame_processor import FrameDirection from pipecat.services.tts_service import AudioContextWordTTSService, TTSService from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.text.base_text_aggregator import BaseTextAggregator from pipecat.utils.text.skip_tags_aggregator import SkipTagsAggregator from pipecat.utils.tracing.service_decorators import traced_tts -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator # See .env.example for Cartesia configuration needed try: diff --git a/src/pipecat/services/elevenlabs/tts.py b/src/pipecat/services/elevenlabs/tts.py index 7665632fc..a8c4ae0c9 100644 --- a/src/pipecat/services/elevenlabs/tts.py +++ b/src/pipecat/services/elevenlabs/tts.py @@ -32,8 +32,8 @@ from pipecat.services.tts_service import ( WordTTSService, ) from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_tts -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator # See .env.example for ElevenLabs configuration needed try: diff --git a/src/pipecat/services/gemini_multimodal_live/gemini.py b/src/pipecat/services/gemini_multimodal_live/gemini.py index c713c3cab..8424a8625 100644 --- a/src/pipecat/services/gemini_multimodal_live/gemini.py +++ b/src/pipecat/services/gemini_multimodal_live/gemini.py @@ -58,10 +58,10 @@ from pipecat.services.openai.llm import ( OpenAIUserContextAggregator, ) from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.string import match_endofsentence from pipecat.utils.time import time_now_iso8601 from pipecat.utils.tracing.service_decorators import traced_gemini_live, traced_stt -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator from . import events diff --git a/src/pipecat/services/gladia/stt.py b/src/pipecat/services/gladia/stt.py index 75e8bbee3..b0ba81470 100644 --- a/src/pipecat/services/gladia/stt.py +++ b/src/pipecat/services/gladia/stt.py @@ -25,9 +25,9 @@ from pipecat.frames.frames import ( from pipecat.services.gladia.config import GladiaInputParams from pipecat.services.stt_service import STTService from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.time import time_now_iso8601 from pipecat.utils.tracing.service_decorators import traced_stt -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator try: import websockets diff --git a/src/pipecat/services/google/llm.py b/src/pipecat/services/google/llm.py index 5fe005fbd..a7d9b018d 100644 --- a/src/pipecat/services/google/llm.py +++ b/src/pipecat/services/google/llm.py @@ -47,8 +47,8 @@ from pipecat.services.openai.llm import ( OpenAIAssistantContextAggregator, OpenAIUserContextAggregator, ) +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_llm -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator # Suppress gRPC fork warnings os.environ["GRPC_ENABLE_FORK_SUPPORT"] = "false" diff --git a/src/pipecat/services/google/llm_openai.py b/src/pipecat/services/google/llm_openai.py index e76ac1886..af49fa6e0 100644 --- a/src/pipecat/services/google/llm_openai.py +++ b/src/pipecat/services/google/llm_openai.py @@ -11,7 +11,7 @@ from openai import AsyncStream from openai.types.chat import ChatCompletionChunk from pipecat.services.llm_service import FunctionCallFromLLM -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator # Suppress gRPC fork warnings os.environ["GRPC_ENABLE_FORK_SUPPORT"] = "false" diff --git a/src/pipecat/services/google/stt.py b/src/pipecat/services/google/stt.py index 80f061b44..157810dd7 100644 --- a/src/pipecat/services/google/stt.py +++ b/src/pipecat/services/google/stt.py @@ -9,8 +9,8 @@ import json import os import time +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_stt -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator # Suppress gRPC fork warnings os.environ["GRPC_ENABLE_FORK_SUPPORT"] = "false" diff --git a/src/pipecat/services/neuphonic/tts.py b/src/pipecat/services/neuphonic/tts.py index 85bd9d0cc..6d9a47a03 100644 --- a/src/pipecat/services/neuphonic/tts.py +++ b/src/pipecat/services/neuphonic/tts.py @@ -29,8 +29,8 @@ from pipecat.frames.frames import ( from pipecat.processors.frame_processor import FrameDirection from pipecat.services.tts_service import InterruptibleTTSService, TTSService from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_tts -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator try: import websockets diff --git a/src/pipecat/services/openai/base_llm.py b/src/pipecat/services/openai/base_llm.py index 32d154495..f3e6b0bb3 100644 --- a/src/pipecat/services/openai/base_llm.py +++ b/src/pipecat/services/openai/base_llm.py @@ -37,8 +37,8 @@ from pipecat.processors.aggregators.openai_llm_context import ( ) from pipecat.processors.frame_processor import FrameDirection from pipecat.services.llm_service import FunctionCallFromLLM, LLMService +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_llm -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator class BaseOpenAILLMService(LLMService): diff --git a/src/pipecat/services/openai_realtime_beta/openai.py b/src/pipecat/services/openai_realtime_beta/openai.py index 8d5168c70..da70b6118 100644 --- a/src/pipecat/services/openai_realtime_beta/openai.py +++ b/src/pipecat/services/openai_realtime_beta/openai.py @@ -51,9 +51,9 @@ from pipecat.processors.frame_processor import FrameDirection from pipecat.services.llm_service import FunctionCallFromLLM, LLMService from pipecat.services.openai.llm import OpenAIContextAggregatorPair from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.time import time_now_iso8601 from pipecat.utils.tracing.service_decorators import traced_openai_realtime, traced_stt -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator from . import events from .context import ( diff --git a/src/pipecat/services/riva/stt.py b/src/pipecat/services/riva/stt.py index 284252adb..22fde1f54 100644 --- a/src/pipecat/services/riva/stt.py +++ b/src/pipecat/services/riva/stt.py @@ -21,9 +21,9 @@ from pipecat.frames.frames import ( ) from pipecat.services.stt_service import SegmentedSTTService, STTService from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue from pipecat.utils.time import time_now_iso8601 from pipecat.utils.tracing.service_decorators import traced_stt -from pipecat.utils.watchdog_queue import WatchdogQueue try: import riva.client diff --git a/src/pipecat/services/sambanova/llm.py b/src/pipecat/services/sambanova/llm.py index 3ca2ee5be..d70860a7e 100644 --- a/src/pipecat/services/sambanova/llm.py +++ b/src/pipecat/services/sambanova/llm.py @@ -18,8 +18,8 @@ from pipecat.metrics.metrics import LLMTokenUsage from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.services.llm_service import FunctionCallFromLLM from pipecat.services.openai.llm import OpenAILLMService +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator from pipecat.utils.tracing.service_decorators import traced_llm -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator class SambaNovaLLMService(OpenAILLMService): # type: ignore diff --git a/src/pipecat/services/simli/video.py b/src/pipecat/services/simli/video.py index 2bca697cb..aef4d8022 100644 --- a/src/pipecat/services/simli/video.py +++ b/src/pipecat/services/simli/video.py @@ -18,7 +18,7 @@ from pipecat.frames.frames import ( TTSAudioRawFrame, ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor, StartFrame -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator try: from av.audio.frame import AudioFrame diff --git a/src/pipecat/services/tavus/video.py b/src/pipecat/services/tavus/video.py index 9688aaebc..c71a5159c 100644 --- a/src/pipecat/services/tavus/video.py +++ b/src/pipecat/services/tavus/video.py @@ -27,7 +27,7 @@ from pipecat.frames.frames import ( from pipecat.processors.frame_processor import FrameDirection, FrameProcessorSetup from pipecat.services.ai_service import AIService from pipecat.transports.services.tavus import TavusCallbacks, TavusParams, TavusTransportClient -from pipecat.utils.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue class TavusVideoService(AIService): diff --git a/src/pipecat/services/tts_service.py b/src/pipecat/services/tts_service.py index 6facf5650..6fb0f4988 100644 --- a/src/pipecat/services/tts_service.py +++ b/src/pipecat/services/tts_service.py @@ -37,11 +37,11 @@ from pipecat.processors.frame_processor import FrameDirection from pipecat.services.ai_service import AIService from pipecat.services.websocket_service import WebsocketService from pipecat.transcriptions.language import Language +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue from pipecat.utils.text.base_text_aggregator import BaseTextAggregator from pipecat.utils.text.base_text_filter import BaseTextFilter from pipecat.utils.text.simple_text_aggregator import SimpleTextAggregator from pipecat.utils.time import seconds_to_nanoseconds -from pipecat.utils.watchdog_queue import WatchdogQueue class TTSService(AIService): diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index f477be447..95aba7320 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -39,8 +39,8 @@ from pipecat.frames.frames import ( ) from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.transports.base_transport import TransportParams +from pipecat.utils.asyncio.watchdog_priority_queue import WatchdogPriorityQueue from pipecat.utils.time import nanoseconds_to_seconds -from pipecat.utils.watchdog_priority_queue import WatchdogPriorityQueue BOT_VAD_STOP_SECS = 0.35 diff --git a/src/pipecat/transports/network/fastapi_websocket.py b/src/pipecat/transports/network/fastapi_websocket.py index 3d19cb05f..790f5f99a 100644 --- a/src/pipecat/transports/network/fastapi_websocket.py +++ b/src/pipecat/transports/network/fastapi_websocket.py @@ -31,7 +31,7 @@ from pipecat.serializers.base_serializer import FrameSerializer, FrameSerializer from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator try: from fastapi import WebSocket diff --git a/src/pipecat/transports/network/small_webrtc.py b/src/pipecat/transports/network/small_webrtc.py index 086aa383c..89895b8ab 100644 --- a/src/pipecat/transports/network/small_webrtc.py +++ b/src/pipecat/transports/network/small_webrtc.py @@ -33,7 +33,7 @@ from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator try: import cv2 diff --git a/src/pipecat/transports/network/websocket_client.py b/src/pipecat/transports/network/websocket_client.py index 738904546..98c7f9e2d 100644 --- a/src/pipecat/transports/network/websocket_client.py +++ b/src/pipecat/transports/network/websocket_client.py @@ -30,7 +30,7 @@ from pipecat.serializers.protobuf import ProtobufFrameSerializer from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from pipecat.utils.asyncio import BaseTaskManager +from pipecat.utils.asyncio.task_manager import BaseTaskManager class WebsocketClientParams(TransportParams): diff --git a/src/pipecat/transports/services/daily.py b/src/pipecat/transports/services/daily.py index f92d632ca..42c126eb4 100644 --- a/src/pipecat/transports/services/daily.py +++ b/src/pipecat/transports/services/daily.py @@ -39,9 +39,9 @@ from pipecat.transcriptions.language import Language from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from pipecat.utils.asyncio import BaseTaskManager -from pipecat.utils.watchdog_queue import WatchdogQueue -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.task_manager import BaseTaskManager +from pipecat.utils.asyncio.watchdog_queue import WatchdogQueue +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter try: from daily import ( diff --git a/src/pipecat/transports/services/livekit.py b/src/pipecat/transports/services/livekit.py index 67ea6b32a..9524bb9e3 100644 --- a/src/pipecat/transports/services/livekit.py +++ b/src/pipecat/transports/services/livekit.py @@ -27,8 +27,8 @@ from pipecat.processors.frame_processor import FrameDirection, FrameProcessorSet from pipecat.transports.base_input import BaseInputTransport from pipecat.transports.base_output import BaseOutputTransport from pipecat.transports.base_transport import BaseTransport, TransportParams -from pipecat.utils.asyncio import BaseTaskManager -from pipecat.utils.watchdog_async_iterator import WatchdogAsyncIterator +from pipecat.utils.asyncio.task_manager import BaseTaskManager +from pipecat.utils.asyncio.watchdog_async_iterator import WatchdogAsyncIterator try: from livekit import rtc diff --git a/src/pipecat/utils/asyncio/__init__.py b/src/pipecat/utils/asyncio/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/pipecat/utils/asyncio.py b/src/pipecat/utils/asyncio/task_manager.py similarity index 100% rename from src/pipecat/utils/asyncio.py rename to src/pipecat/utils/asyncio/task_manager.py diff --git a/src/pipecat/utils/watchdog_async_iterator.py b/src/pipecat/utils/asyncio/watchdog_async_iterator.py similarity index 97% rename from src/pipecat/utils/watchdog_async_iterator.py rename to src/pipecat/utils/asyncio/watchdog_async_iterator.py index 62b6d1a23..e35d3d54c 100644 --- a/src/pipecat/utils/watchdog_async_iterator.py +++ b/src/pipecat/utils/asyncio/watchdog_async_iterator.py @@ -7,7 +7,7 @@ import asyncio from typing import AsyncIterator, Optional -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter class WatchdogAsyncIterator: diff --git a/src/pipecat/utils/watchdog_event.py b/src/pipecat/utils/asyncio/watchdog_event.py similarity index 94% rename from src/pipecat/utils/watchdog_event.py rename to src/pipecat/utils/asyncio/watchdog_event.py index 001a0cf26..823c0db82 100644 --- a/src/pipecat/utils/watchdog_event.py +++ b/src/pipecat/utils/asyncio/watchdog_event.py @@ -6,7 +6,7 @@ import asyncio -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter class WatchdogEvent(asyncio.Event): diff --git a/src/pipecat/utils/watchdog_priority_queue.py b/src/pipecat/utils/asyncio/watchdog_priority_queue.py similarity index 95% rename from src/pipecat/utils/watchdog_priority_queue.py rename to src/pipecat/utils/asyncio/watchdog_priority_queue.py index a3635667c..fb1071c58 100644 --- a/src/pipecat/utils/watchdog_priority_queue.py +++ b/src/pipecat/utils/asyncio/watchdog_priority_queue.py @@ -6,7 +6,7 @@ import asyncio -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter class WatchdogPriorityQueue(asyncio.PriorityQueue): diff --git a/src/pipecat/utils/watchdog_queue.py b/src/pipecat/utils/asyncio/watchdog_queue.py similarity index 95% rename from src/pipecat/utils/watchdog_queue.py rename to src/pipecat/utils/asyncio/watchdog_queue.py index 6eb9dab10..5a9d86cb6 100644 --- a/src/pipecat/utils/watchdog_queue.py +++ b/src/pipecat/utils/asyncio/watchdog_queue.py @@ -6,7 +6,7 @@ import asyncio -from pipecat.utils.watchdog_reseter import WatchdogReseter +from pipecat.utils.asyncio.watchdog_reseter import WatchdogReseter class WatchdogQueue(asyncio.Queue): diff --git a/src/pipecat/utils/watchdog_reseter.py b/src/pipecat/utils/asyncio/watchdog_reseter.py similarity index 100% rename from src/pipecat/utils/watchdog_reseter.py rename to src/pipecat/utils/asyncio/watchdog_reseter.py