From aa6e81648a7cac657771c97abd42aaf2551455ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 19:00:54 -0700 Subject: [PATCH 1/7] move openai_realtime to openai.realtime --- examples/foundational/19-openai-realtime.py | 7 ++++--- examples/foundational/19b-openai-realtime-text.py | 7 ++++--- .../20b-persistent-context-openai-realtime.py | 7 ++++--- src/pipecat/services/openai/__init__.py | 1 + src/pipecat/services/openai/realtime/__init__.py | 0 .../{openai_realtime => openai/realtime}/azure.py | 0 .../{openai_realtime => openai/realtime}/context.py | 0 .../{openai_realtime => openai/realtime}/events.py | 0 .../{openai_realtime => openai/realtime}/frames.py | 2 +- .../{openai_realtime => openai/realtime}/openai.py | 0 src/pipecat/services/openai_realtime/__init__.py | 9 --------- 11 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 src/pipecat/services/openai/realtime/__init__.py rename src/pipecat/services/{openai_realtime => openai/realtime}/azure.py (100%) rename src/pipecat/services/{openai_realtime => openai/realtime}/context.py (100%) rename src/pipecat/services/{openai_realtime => openai/realtime}/events.py (100%) rename src/pipecat/services/{openai_realtime => openai/realtime}/frames.py (93%) rename src/pipecat/services/{openai_realtime => openai/realtime}/openai.py (100%) delete mode 100644 src/pipecat/services/openai_realtime/__init__.py diff --git a/examples/foundational/19-openai-realtime.py b/examples/foundational/19-openai-realtime.py index 0f9309f3d..aff4e15d7 100644 --- a/examples/foundational/19-openai-realtime.py +++ b/examples/foundational/19-openai-realtime.py @@ -24,14 +24,15 @@ from pipecat.processors.transcript_processor import TranscriptProcessor from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.llm_service import FunctionCallParams -from pipecat.services.openai_realtime import ( +from pipecat.services.openai.realtime.events import ( + AudioConfiguration, + AudioInput, InputAudioNoiseReduction, InputAudioTranscription, - OpenAIRealtimeLLMService, SemanticTurnDetection, SessionProperties, ) -from pipecat.services.openai_realtime.events import AudioConfiguration, AudioInput +from pipecat.services.openai.realtime.openai import OpenAIRealtimeLLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/examples/foundational/19b-openai-realtime-text.py b/examples/foundational/19b-openai-realtime-text.py index b5d1d73e1..8ac916b23 100644 --- a/examples/foundational/19b-openai-realtime-text.py +++ b/examples/foundational/19b-openai-realtime-text.py @@ -24,14 +24,15 @@ from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia import CartesiaTTSService from pipecat.services.llm_service import FunctionCallParams -from pipecat.services.openai_realtime import ( +from pipecat.services.openai.realtime.events import ( + AudioConfiguration, + AudioInput, InputAudioNoiseReduction, InputAudioTranscription, - OpenAIRealtimeLLMService, SemanticTurnDetection, SessionProperties, ) -from pipecat.services.openai_realtime.events import AudioConfiguration, AudioInput +from pipecat.services.openai.realtime.openai import OpenAIRealtimeLLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/examples/foundational/20b-persistent-context-openai-realtime.py b/examples/foundational/20b-persistent-context-openai-realtime.py index 52c7d8f49..100109de3 100644 --- a/examples/foundational/20b-persistent-context-openai-realtime.py +++ b/examples/foundational/20b-persistent-context-openai-realtime.py @@ -25,13 +25,14 @@ from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.llm_service import FunctionCallParams -from pipecat.services.openai_realtime import ( +from pipecat.services.openai.realtime.events import ( + AudioConfiguration, + AudioInput, InputAudioTranscription, - OpenAIRealtimeLLMService, SessionProperties, TurnDetection, ) -from pipecat.services.openai_realtime.events import AudioConfiguration, AudioInput +from pipecat.services.openai.realtime.openai import OpenAIRealtimeLLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/src/pipecat/services/openai/__init__.py b/src/pipecat/services/openai/__init__.py index 4decac126..d913c5ee0 100644 --- a/src/pipecat/services/openai/__init__.py +++ b/src/pipecat/services/openai/__init__.py @@ -10,6 +10,7 @@ from pipecat.services import DeprecatedModuleProxy from .image import * from .llm import * +from .realtime import * from .stt import * from .tts import * diff --git a/src/pipecat/services/openai/realtime/__init__.py b/src/pipecat/services/openai/realtime/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/pipecat/services/openai_realtime/azure.py b/src/pipecat/services/openai/realtime/azure.py similarity index 100% rename from src/pipecat/services/openai_realtime/azure.py rename to src/pipecat/services/openai/realtime/azure.py diff --git a/src/pipecat/services/openai_realtime/context.py b/src/pipecat/services/openai/realtime/context.py similarity index 100% rename from src/pipecat/services/openai_realtime/context.py rename to src/pipecat/services/openai/realtime/context.py diff --git a/src/pipecat/services/openai_realtime/events.py b/src/pipecat/services/openai/realtime/events.py similarity index 100% rename from src/pipecat/services/openai_realtime/events.py rename to src/pipecat/services/openai/realtime/events.py diff --git a/src/pipecat/services/openai_realtime/frames.py b/src/pipecat/services/openai/realtime/frames.py similarity index 93% rename from src/pipecat/services/openai_realtime/frames.py rename to src/pipecat/services/openai/realtime/frames.py index 290e025f9..8617c6efd 100644 --- a/src/pipecat/services/openai_realtime/frames.py +++ b/src/pipecat/services/openai/realtime/frames.py @@ -12,7 +12,7 @@ from typing import TYPE_CHECKING from pipecat.frames.frames import DataFrame, FunctionCallResultFrame if TYPE_CHECKING: - from pipecat.services.openai_realtime.context import OpenAIRealtimeLLMContext + from pipecat.services.openai.realtime.context import OpenAIRealtimeLLMContext @dataclass diff --git a/src/pipecat/services/openai_realtime/openai.py b/src/pipecat/services/openai/realtime/openai.py similarity index 100% rename from src/pipecat/services/openai_realtime/openai.py rename to src/pipecat/services/openai/realtime/openai.py diff --git a/src/pipecat/services/openai_realtime/__init__.py b/src/pipecat/services/openai_realtime/__init__.py deleted file mode 100644 index 6f3154f1c..000000000 --- a/src/pipecat/services/openai_realtime/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -from .azure import AzureRealtimeLLMService -from .events import ( - InputAudioNoiseReduction, - InputAudioTranscription, - SemanticTurnDetection, - SessionProperties, - TurnDetection, -) -from .openai import OpenAIRealtimeLLMService From 303dd2ec355e4a1e2804ad071d85c44342d62595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 19:02:40 -0700 Subject: [PATCH 2/7] move openai.realtime.openai to openai.realtime.llm --- examples/foundational/19-openai-realtime.py | 2 +- examples/foundational/19b-openai-realtime-text.py | 2 +- examples/foundational/20b-persistent-context-openai-realtime.py | 2 +- src/pipecat/services/openai/realtime/{openai.py => llm.py} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/pipecat/services/openai/realtime/{openai.py => llm.py} (100%) diff --git a/examples/foundational/19-openai-realtime.py b/examples/foundational/19-openai-realtime.py index aff4e15d7..f182d7c8c 100644 --- a/examples/foundational/19-openai-realtime.py +++ b/examples/foundational/19-openai-realtime.py @@ -32,7 +32,7 @@ from pipecat.services.openai.realtime.events import ( SemanticTurnDetection, SessionProperties, ) -from pipecat.services.openai.realtime.openai import OpenAIRealtimeLLMService +from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/examples/foundational/19b-openai-realtime-text.py b/examples/foundational/19b-openai-realtime-text.py index 8ac916b23..33f3a1cb2 100644 --- a/examples/foundational/19b-openai-realtime-text.py +++ b/examples/foundational/19b-openai-realtime-text.py @@ -32,7 +32,7 @@ from pipecat.services.openai.realtime.events import ( SemanticTurnDetection, SessionProperties, ) -from pipecat.services.openai.realtime.openai import OpenAIRealtimeLLMService +from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/examples/foundational/20b-persistent-context-openai-realtime.py b/examples/foundational/20b-persistent-context-openai-realtime.py index 100109de3..629a17c67 100644 --- a/examples/foundational/20b-persistent-context-openai-realtime.py +++ b/examples/foundational/20b-persistent-context-openai-realtime.py @@ -32,7 +32,7 @@ from pipecat.services.openai.realtime.events import ( SessionProperties, TurnDetection, ) -from pipecat.services.openai.realtime.openai import OpenAIRealtimeLLMService +from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/src/pipecat/services/openai/realtime/openai.py b/src/pipecat/services/openai/realtime/llm.py similarity index 100% rename from src/pipecat/services/openai/realtime/openai.py rename to src/pipecat/services/openai/realtime/llm.py From 7b05c9283b2f4f0db086daa5a373f794df527319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 19:06:09 -0700 Subject: [PATCH 3/7] move openai.realtime.azure to azure.realtime.llm --- examples/foundational/19a-azure-realtime.py | 7 ++++--- src/pipecat/services/azure/realtime/__init__.py | 0 .../{openai/realtime/azure.py => azure/realtime/llm.py} | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 src/pipecat/services/azure/realtime/__init__.py rename src/pipecat/services/{openai/realtime/azure.py => azure/realtime/llm.py} (91%) diff --git a/examples/foundational/19a-azure-realtime.py b/examples/foundational/19a-azure-realtime.py index a39826b81..c4b0fc02a 100644 --- a/examples/foundational/19a-azure-realtime.py +++ b/examples/foundational/19a-azure-realtime.py @@ -21,13 +21,14 @@ from pipecat.pipeline.task import PipelineParams, PipelineTask from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport +from pipecat.services.azure.realtime.llm import AzureRealtimeLLMService from pipecat.services.llm_service import FunctionCallParams -from pipecat.services.openai_realtime import ( - AzureRealtimeLLMService, +from pipecat.services.openai.realtime.events import ( + AudioConfiguration, + AudioInput, InputAudioTranscription, SessionProperties, ) -from pipecat.services.openai_realtime.events import AudioConfiguration, AudioInput from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams diff --git a/src/pipecat/services/azure/realtime/__init__.py b/src/pipecat/services/azure/realtime/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/pipecat/services/openai/realtime/azure.py b/src/pipecat/services/azure/realtime/llm.py similarity index 91% rename from src/pipecat/services/openai/realtime/azure.py rename to src/pipecat/services/azure/realtime/llm.py index aed53b94c..fb420e10b 100644 --- a/src/pipecat/services/openai/realtime/azure.py +++ b/src/pipecat/services/azure/realtime/llm.py @@ -8,15 +8,13 @@ from loguru import logger -from .openai import OpenAIRealtimeLLMService +from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService try: from websockets.asyncio.client import connect as websocket_connect except ModuleNotFoundError as e: logger.error(f"Exception: {e}") - logger.error( - "In order to use OpenAI, you need to `pip install pipecat-ai[openai]`. Also, set `OPENAI_API_KEY` environment variable." - ) + logger.error("In order to use Azure Realtime, you need to `pip install pipecat-ai[openai]`.") raise Exception(f"Missing module: {e}") From 9698b008da9363675b7c07cce49e252ce9e56e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 19:13:25 -0700 Subject: [PATCH 4/7] deprecate openai_realtime --- .../services/openai_realtime/__init__.py | 27 +++++++++++++++++++ src/pipecat/services/openai_realtime/azure.py | 21 +++++++++++++++ .../services/openai_realtime/context.py | 21 +++++++++++++++ .../services/openai_realtime/events.py | 21 +++++++++++++++ .../services/openai_realtime/frames.py | 21 +++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 src/pipecat/services/openai_realtime/__init__.py create mode 100644 src/pipecat/services/openai_realtime/azure.py create mode 100644 src/pipecat/services/openai_realtime/context.py create mode 100644 src/pipecat/services/openai_realtime/events.py create mode 100644 src/pipecat/services/openai_realtime/frames.py diff --git a/src/pipecat/services/openai_realtime/__init__.py b/src/pipecat/services/openai_realtime/__init__.py new file mode 100644 index 000000000..f1fbefeda --- /dev/null +++ b/src/pipecat/services/openai_realtime/__init__.py @@ -0,0 +1,27 @@ +# +# Copyright (c) 2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +import warnings + +from pipecat.services.azure.realtime.llm import AzureRealtimeLLMService +from pipecat.services.openai.realtime.events import ( + InputAudioNoiseReduction, + InputAudioTranscription, + SemanticTurnDetection, + SessionProperties, + TurnDetection, +) +from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService + +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Types in pipecat.services.openai_realtime are deprecated. " + "Please use the equivalent types from " + "pipecat.services.openai.realtime instead.", + DeprecationWarning, + stacklevel=2, + ) diff --git a/src/pipecat/services/openai_realtime/azure.py b/src/pipecat/services/openai_realtime/azure.py new file mode 100644 index 000000000..dae6ef496 --- /dev/null +++ b/src/pipecat/services/openai_realtime/azure.py @@ -0,0 +1,21 @@ +# +# Copyright (c) 2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +"""Azure OpenAI Realtime LLM service implementation.""" + +import warnings + +from pipecat.services.azure.realtime.llm import * + +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Types in pipecat.services.openai_realtime.azure are deprecated. " + "Please use the equivalent types from " + "pipecat.services.azure.realtime.llm instead.", + DeprecationWarning, + stacklevel=2, + ) diff --git a/src/pipecat/services/openai_realtime/context.py b/src/pipecat/services/openai_realtime/context.py new file mode 100644 index 000000000..58f1cfe75 --- /dev/null +++ b/src/pipecat/services/openai_realtime/context.py @@ -0,0 +1,21 @@ +# +# Copyright (c) 2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +"""OpenAI Realtime LLM context and aggregator implementations.""" + +import warnings + +from pipecat.services.openai.realtime.context import * + +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Types in pipecat.services.openai_realtime.context are deprecated. " + "Please use the equivalent types from " + "pipecat.services.openai.realtime.context instead.", + DeprecationWarning, + stacklevel=2, + ) diff --git a/src/pipecat/services/openai_realtime/events.py b/src/pipecat/services/openai_realtime/events.py new file mode 100644 index 000000000..53b4b0dff --- /dev/null +++ b/src/pipecat/services/openai_realtime/events.py @@ -0,0 +1,21 @@ +# +# Copyright (c) 2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +"""Event models and data structures for OpenAI Realtime API communication.""" + +import warnings + +from pipecat.services.openai.realtime.events import * + +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Types in pipecat.services.openai_realtime.events are deprecated. " + "Please use the equivalent types from " + "pipecat.services.openai.realtime.events instead.", + DeprecationWarning, + stacklevel=2, + ) diff --git a/src/pipecat/services/openai_realtime/frames.py b/src/pipecat/services/openai_realtime/frames.py new file mode 100644 index 000000000..e7e4d7d9f --- /dev/null +++ b/src/pipecat/services/openai_realtime/frames.py @@ -0,0 +1,21 @@ +# +# Copyright (c) 2025, Daily +# +# SPDX-License-Identifier: BSD 2-Clause License +# + +"""Custom frame types for OpenAI Realtime API integration.""" + +import warnings + +from pipecat.services.openai.realtime.frames import * + +with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "Types in pipecat.services.openai_realtime.frames are deprecated. " + "Please use the equivalent types from " + "pipecat.services.openai.realtime.frames instead.", + DeprecationWarning, + stacklevel=2, + ) From d81b0f63689d0b3c106379dee5b12924f8b6a2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 19:14:43 -0700 Subject: [PATCH 5/7] update CHANGELOG with openai_realtime deprecation --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9493c9d06..7079f21f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +- `pipecat.service.openai_realtime` is now deprecated, use + `pipecat.services.openai.realtime` instead or + `pipecat.services.azure.realtime` for Azure Realtime. + - `pipecat.service.aws_nova_sonic` is now deprecated, use `pipecat.services.aws.nova_sonic` instead. From 5679dde70fa259c7070e554a37ce9ec44dc8e9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 22:09:11 -0700 Subject: [PATCH 6/7] ai_service: use openai.realtime.events instead of openai_realtime_beta.events --- src/pipecat/services/ai_service.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pipecat/services/ai_service.py b/src/pipecat/services/ai_service.py index eebdbfb0b..759efcf00 100644 --- a/src/pipecat/services/ai_service.py +++ b/src/pipecat/services/ai_service.py @@ -97,9 +97,7 @@ class AIService(FrameProcessor): pass async def _update_settings(self, settings: Mapping[str, Any]): - from pipecat.services.openai_realtime_beta.events import ( - SessionProperties, - ) + from pipecat.services.openai.realtime.events import SessionProperties for key, value in settings.items(): logger.debug("Update request for:", key, value) @@ -111,9 +109,7 @@ class AIService(FrameProcessor): logger.debug("Attempting to update", key, value) try: - from pipecat.services.openai_realtime_beta.events import ( - TurnDetection, - ) + from pipecat.services.openai.realtime.events import TurnDetection if isinstance(self._session_properties, SessionProperties): current_properties = self._session_properties From 9935a68018c43b5388fa07e41553eb9aca229112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 9 Oct 2025 22:14:52 -0700 Subject: [PATCH 7/7] examples(19b): fix deprecations --- examples/foundational/19b-openai-realtime-text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/foundational/19b-openai-realtime-text.py b/examples/foundational/19b-openai-realtime-text.py index 33f3a1cb2..bb63a4814 100644 --- a/examples/foundational/19b-openai-realtime-text.py +++ b/examples/foundational/19b-openai-realtime-text.py @@ -22,7 +22,7 @@ from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.transcript_processor import TranscriptProcessor from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport -from pipecat.services.cartesia import CartesiaTTSService +from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.llm_service import FunctionCallParams from pipecat.services.openai.realtime.events import ( AudioConfiguration,