diff --git a/getstream/video/__init__.py b/getstream/video/__init__.py index cd6fc721..7510870b 100644 --- a/getstream/video/__init__.py +++ b/getstream/video/__init__.py @@ -1,4 +1,5 @@ from __future__ import annotations +import warnings from typing import TYPE_CHECKING from dataclasses import dataclass @@ -38,6 +39,21 @@ def _sync_from_response(self, data): def connect_openai( self, openai_api_key, agent_user_id, model="gpt-4o-realtime-preview" ): + """Connect an OpenAI Realtime agent to this call through Stream's + ``/video/connect_agent`` proxy. + + .. deprecated:: + The OpenAI Realtime proxy is deprecated and will be removed in a + future major release. Build voice and video AI agents with Vision + Agents instead: https://visionagents.ai/integrations/llm/openai + """ + warnings.warn( + "connect_openai is deprecated and will be removed in a future major " + "release. Build voice and video AI agents with Vision Agents instead: " + "https://visionagents.ai/integrations/llm/openai", + DeprecationWarning, + stacklevel=2, + ) from .openai import get_openai_realtime_client, ConnectionManagerWrapper client = get_openai_realtime_client(openai_api_key, self.client.base_url or "") diff --git a/tests/test_video_openai.py b/tests/test_video_openai.py index 4eb1674b..9730c5a2 100644 --- a/tests/test_video_openai.py +++ b/tests/test_video_openai.py @@ -330,3 +330,15 @@ def test_get_openai_realtime_client_from_env(self): # Verify that the API key was passed correctly mock_openai.AsyncOpenAI.assert_called_once_with(api_key=openai_api_key) + + def test_connect_openai_emits_deprecation_warning(self): + """Test that connect_openai warns that the OpenAI Realtime proxy is deprecated.""" + from getstream.video import BaseCall + + call = BaseCall(MagicMock(), "default", "test-call") + + with ( + patch("getstream.video.openai.get_openai_realtime_client"), + pytest.warns(DeprecationWarning, match="Vision Agents"), + ): + call.connect_openai("fake-api-key", "test-agent")