From be562cedfc01d9f94f7ae34a689076eb4ca2e493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 25 Sep 2025 14:23:39 -0700 Subject: [PATCH] DailyTransport: deprecate DailyTransportMessage(Urgent)Frame --- CHANGELOG.md | 4 ++ .../16-gpu-container-local-bot.py | 12 ++-- src/pipecat/transports/daily/transport.py | 60 ++++++++++++++++++- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a0918b0b..0a50cc8ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +- `DailyTransportMessageFrame` and `DailyTransportMessageUrgentFrame` are + deprecated, use `DailyOutputTransportMessageFrame` and + `DailyOutputTransportMessageUrgentFrame` respectively instead. + - `LiveKitTransportMessageFrame` and `LiveKitTransportMessageUrgentFrame` are deprecated, use `LiveKitOutputTransportMessageFrame` and `LiveKitOutputTransportMessageUrgentFrame` respectively instead. diff --git a/examples/foundational/16-gpu-container-local-bot.py b/examples/foundational/16-gpu-container-local-bot.py index 89316e63c..90ff271c6 100644 --- a/examples/foundational/16-gpu-container-local-bot.py +++ b/examples/foundational/16-gpu-container-local-bot.py @@ -26,7 +26,11 @@ from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.deepgram.tts import DeepgramTTSService from pipecat.services.openai.llm import OpenAILLMService from pipecat.transports.base_transport import BaseTransport, TransportParams -from pipecat.transports.daily.transport import DailyParams, DailyTransportMessageFrame +from pipecat.transports.daily.transport import ( + DailyOutputTransportMessageFrame, + DailyOutputTransportMessageUrgentFrame, + DailyParams, +) from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams load_dotenv(override=True) @@ -128,14 +132,14 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): logger.debug(f"Received latency ping app message: {message}") ts = message["latency-ping"]["ts"] # Send immediately - transport.output().send_message( - DailyTransportMessageFrame( + await task.queue_frame( + DailyOutputTransportMessageUrgentFrame( message={"latency-pong-msg-handler": {"ts": ts}}, participant_id=sender ) ) # And push to the pipeline for the Daily transport.output to send await task.queue_frame( - DailyTransportMessageFrame( + DailyOutputTransportMessageFrame( message={"latency-pong-pipeline-delivery": {"ts": ts}}, participant_id=sender, ) diff --git a/src/pipecat/transports/daily/transport.py b/src/pipecat/transports/daily/transport.py index 787216341..7f6b21ee2 100644 --- a/src/pipecat/transports/daily/transport.py +++ b/src/pipecat/transports/daily/transport.py @@ -74,7 +74,7 @@ VAD_RESET_PERIOD_MS = 2000 @dataclass -class DailyTransportMessageFrame(OutputTransportMessageFrame): +class DailyOutputTransportMessageFrame(OutputTransportMessageFrame): """Frame for transport messages in Daily calls. Parameters: @@ -85,7 +85,7 @@ class DailyTransportMessageFrame(OutputTransportMessageFrame): @dataclass -class DailyTransportMessageUrgentFrame(OutputTransportMessageUrgentFrame): +class DailyOutputTransportMessageUrgentFrame(OutputTransportMessageUrgentFrame): """Frame for urgent transport messages in Daily calls. Parameters: @@ -95,6 +95,58 @@ class DailyTransportMessageUrgentFrame(OutputTransportMessageUrgentFrame): participant_id: Optional[str] = None +@dataclass +class DailyTransportMessageFrame(DailyOutputTransportMessageFrame): + """Frame for transport messages in Daily calls. + + .. deprecated:: 0.0.87 + This frame is deprecated and will be removed in a future version. + Instead, use `DailyOutputTransportMessageFrame`. + + Parameters: + participant_id: Optional ID of the participant this message is for/from. + """ + + def __post_init__(self): + super().__post_init__() + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "DailyTransportMessageFrame is deprecated and will be removed in a future version. " + "Instead, use DailyOutputTransportMessageFrame.", + DeprecationWarning, + stacklevel=2, + ) + + +@dataclass +class DailyTransportMessageUrgentFrame(DailyOutputTransportMessageUrgentFrame): + """Frame for urgent transport messages in Daily calls. + + .. deprecated:: 0.0.87 + This frame is deprecated and will be removed in a future version. + Instead, use `DailyOutputTransportMessageUrgentFrame`. + + Parameters: + participant_id: Optional ID of the participant this message is for/from. + """ + + def __post_init__(self): + super().__post_init__() + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "DailyTransportMessageUrgentFrame is deprecated and will be removed in a future version. " + "Instead, use DailyOutputTransportMessageUrgentFrame.", + DeprecationWarning, + stacklevel=2, + ) + + @dataclass class DailyInputTransportMessageFrame(InputTransportMessageFrame): """Frame for input urgent transport messages in Daily calls. @@ -511,7 +563,9 @@ class DailyTransportClient(EventHandler): return participant_id = None - if isinstance(frame, (DailyTransportMessageFrame, DailyTransportMessageUrgentFrame)): + if isinstance( + frame, (DailyOutputTransportMessageFrame, DailyOutputTransportMessageUrgentFrame) + ): participant_id = frame.participant_id future = self._get_event_loop().create_future()