1+ from typing import Any
12from portkey_ai ._vendor .openai .resources .realtime .realtime import (
23 AsyncRealtimeConnectionManager ,
34 RealtimeConnectionManager ,
@@ -14,6 +15,7 @@ class MainRealtime(APIResource):
1415 def __init__ (self , client : Portkey ) -> None :
1516 super ().__init__ (client )
1617 self .openai_client = client .openai_client
18+ self .client_secrets = ClientSecrets (client )
1719
1820 def connect (
1921 self ,
@@ -35,6 +37,7 @@ class AsyncMainRealtime(AsyncAPIResource):
3537 def __init__ (self , client : AsyncPortkey ) -> None :
3638 super ().__init__ (client )
3739 self .openai_client = client .openai_client
40+ self .client_secrets = AsyncClientSecrets (client )
3841
3942 def connect (
4043 self ,
@@ -50,3 +53,57 @@ def connect(
5053 extra_headers = extra_headers ,
5154 websocket_connection_options = websocket_connection_options ,
5255 )
56+
57+
58+ class ClientSecrets (APIResource ):
59+ def __init__ (self , client : Portkey ) -> None :
60+ super ().__init__ (client )
61+ self .openai_client = client .openai_client
62+
63+ def create (
64+ self ,
65+ * ,
66+ expires_after : Any ,
67+ session : Any ,
68+ ** kwargs : Any ,
69+ ) -> Any :
70+ extra_headers = kwargs .pop ("extra_headers" , None )
71+ extra_query = kwargs .pop ("extra_query" , None )
72+ extra_body = kwargs .pop ("extra_body" , None )
73+ timeout = kwargs .pop ("timeout" , None )
74+
75+ return self .openai_client .realtime .client_secrets .create (
76+ expires_after = expires_after ,
77+ session = session ,
78+ extra_headers = extra_headers ,
79+ extra_query = extra_query ,
80+ extra_body = {** (extra_body or {}), ** kwargs },
81+ timeout = timeout ,
82+ )
83+
84+
85+ class AsyncClientSecrets (AsyncAPIResource ):
86+ def __init__ (self , client : AsyncPortkey ) -> None :
87+ super ().__init__ (client )
88+ self .openai_client = client .openai_client
89+
90+ async def create (
91+ self ,
92+ * ,
93+ expires_after : Any ,
94+ session : Any ,
95+ ** kwargs : Any ,
96+ ) -> Any :
97+ extra_headers = kwargs .pop ("extra_headers" , None )
98+ extra_query = kwargs .pop ("extra_query" , None )
99+ extra_body = kwargs .pop ("extra_body" , None )
100+ timeout = kwargs .pop ("timeout" , None )
101+
102+ return await self .openai_client .realtime .client_secrets .create (
103+ expires_after = expires_after ,
104+ session = session ,
105+ extra_headers = extra_headers ,
106+ extra_query = extra_query ,
107+ extra_body = {** (extra_body or {}), ** kwargs },
108+ timeout = timeout ,
109+ )
0 commit comments