Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions getstream/video/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING

from dataclasses import dataclass
Expand Down Expand Up @@ -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 "")
Expand Down
12 changes: 12 additions & 0 deletions tests/test_video_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Loading