From 03ac744bcf542031340a8658a4ea6271a899892e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 7 Feb 2025 09:17:29 -0800 Subject: [PATCH] rtvi: deprecate frame processors --- CHANGELOG.md | 6 +++ src/pipecat/processors/frameworks/rtvi.py | 63 +++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51f68faf8..6f84bdba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `RTVIObserver` doesn't handle `LLMSearchResponseFrame` frames anymore. For now, to handle those frames you need to create a `GoogleRTVIObserver` instead. +### Deprecated + +- All RTVI frame processors (e.g. `RTVISpeakingProcessor`, + `RTVIBotLLMProcessor`) are now deprecated, instantiate an `RTVIObserver` + instead. + ## [0.0.56] - 2025-02-06 ### Changed diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index 630f0e1d6..e405faac5 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -384,6 +384,15 @@ class RTVISpeakingProcessor(RTVIFrameProcessor): def __init__(self, **kwargs): super().__init__(**kwargs) + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVISpeakingProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) @@ -419,6 +428,15 @@ class RTVIUserTranscriptionProcessor(RTVIFrameProcessor): def __init__(self, **kwargs): super().__init__(**kwargs) + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVIUserTranscriptionProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) @@ -450,6 +468,15 @@ class RTVIUserLLMTextProcessor(RTVIFrameProcessor): def __init__(self, **kwargs): super().__init__(**kwargs) + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVIUserLLMTextProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) @@ -477,6 +504,15 @@ class RTVIBotTranscriptionProcessor(RTVIFrameProcessor): super().__init__() self._aggregation = "" + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVIBotTranscriptionProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) @@ -500,6 +536,15 @@ class RTVIBotLLMProcessor(RTVIFrameProcessor): def __init__(self, **kwargs): super().__init__(**kwargs) + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVIBotLLMProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) @@ -518,6 +563,15 @@ class RTVIBotTTSProcessor(RTVIFrameProcessor): def __init__(self, **kwargs): super().__init__(**kwargs) + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVIBotTTSProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) @@ -536,6 +590,15 @@ class RTVIMetricsProcessor(RTVIFrameProcessor): def __init__(self, **kwargs): super().__init__(**kwargs) + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "'RTVIMetricsProcessor' is deprecated, use an 'RTVIObserver' instead.", + DeprecationWarning, + ) + async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction)