DailyTransport: deprecate DailyTransportMessage(Urgent)Frame
This commit is contained in:
@@ -34,6 +34,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
- `DailyTransportMessageFrame` and `DailyTransportMessageUrgentFrame` are
|
||||||
|
deprecated, use `DailyOutputTransportMessageFrame` and
|
||||||
|
`DailyOutputTransportMessageUrgentFrame` respectively instead.
|
||||||
|
|
||||||
- `LiveKitTransportMessageFrame` and `LiveKitTransportMessageUrgentFrame` are
|
- `LiveKitTransportMessageFrame` and `LiveKitTransportMessageUrgentFrame` are
|
||||||
deprecated, use `LiveKitOutputTransportMessageFrame` and
|
deprecated, use `LiveKitOutputTransportMessageFrame` and
|
||||||
`LiveKitOutputTransportMessageUrgentFrame` respectively instead.
|
`LiveKitOutputTransportMessageUrgentFrame` respectively instead.
|
||||||
|
|||||||
@@ -26,7 +26,11 @@ from pipecat.services.deepgram.stt import DeepgramSTTService
|
|||||||
from pipecat.services.deepgram.tts import DeepgramTTSService
|
from pipecat.services.deepgram.tts import DeepgramTTSService
|
||||||
from pipecat.services.openai.llm import OpenAILLMService
|
from pipecat.services.openai.llm import OpenAILLMService
|
||||||
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
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
|
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams
|
||||||
|
|
||||||
load_dotenv(override=True)
|
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}")
|
logger.debug(f"Received latency ping app message: {message}")
|
||||||
ts = message["latency-ping"]["ts"]
|
ts = message["latency-ping"]["ts"]
|
||||||
# Send immediately
|
# Send immediately
|
||||||
transport.output().send_message(
|
await task.queue_frame(
|
||||||
DailyTransportMessageFrame(
|
DailyOutputTransportMessageUrgentFrame(
|
||||||
message={"latency-pong-msg-handler": {"ts": ts}}, participant_id=sender
|
message={"latency-pong-msg-handler": {"ts": ts}}, participant_id=sender
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# And push to the pipeline for the Daily transport.output to send
|
# And push to the pipeline for the Daily transport.output to send
|
||||||
await task.queue_frame(
|
await task.queue_frame(
|
||||||
DailyTransportMessageFrame(
|
DailyOutputTransportMessageFrame(
|
||||||
message={"latency-pong-pipeline-delivery": {"ts": ts}},
|
message={"latency-pong-pipeline-delivery": {"ts": ts}},
|
||||||
participant_id=sender,
|
participant_id=sender,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ VAD_RESET_PERIOD_MS = 2000
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class DailyTransportMessageFrame(OutputTransportMessageFrame):
|
class DailyOutputTransportMessageFrame(OutputTransportMessageFrame):
|
||||||
"""Frame for transport messages in Daily calls.
|
"""Frame for transport messages in Daily calls.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@@ -85,7 +85,7 @@ class DailyTransportMessageFrame(OutputTransportMessageFrame):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class DailyTransportMessageUrgentFrame(OutputTransportMessageUrgentFrame):
|
class DailyOutputTransportMessageUrgentFrame(OutputTransportMessageUrgentFrame):
|
||||||
"""Frame for urgent transport messages in Daily calls.
|
"""Frame for urgent transport messages in Daily calls.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@@ -95,6 +95,58 @@ class DailyTransportMessageUrgentFrame(OutputTransportMessageUrgentFrame):
|
|||||||
participant_id: Optional[str] = None
|
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
|
@dataclass
|
||||||
class DailyInputTransportMessageFrame(InputTransportMessageFrame):
|
class DailyInputTransportMessageFrame(InputTransportMessageFrame):
|
||||||
"""Frame for input urgent transport messages in Daily calls.
|
"""Frame for input urgent transport messages in Daily calls.
|
||||||
@@ -511,7 +563,9 @@ class DailyTransportClient(EventHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
participant_id = None
|
participant_id = None
|
||||||
if isinstance(frame, (DailyTransportMessageFrame, DailyTransportMessageUrgentFrame)):
|
if isinstance(
|
||||||
|
frame, (DailyOutputTransportMessageFrame, DailyOutputTransportMessageUrgentFrame)
|
||||||
|
):
|
||||||
participant_id = frame.participant_id
|
participant_id = frame.participant_id
|
||||||
|
|
||||||
future = self._get_event_loop().create_future()
|
future = self._get_event_loop().create_future()
|
||||||
|
|||||||
Reference in New Issue
Block a user