Skip to content

Commit f1fd4fa

Browse files
feat(client): support sending raw data over websockets
1 parent 73ea2f7 commit f1fd4fa

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/openai/resources/realtime/realtime.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ async def send(self, event: RealtimeClientEvent | RealtimeClientEventParam) -> N
292292
)
293293
await self._connection.send(data)
294294

295+
async def send_raw(self, data: bytes | str) -> None:
296+
await self._connection.send(data)
297+
295298
async def close(self, *, code: int = 1000, reason: str = "") -> None:
296299
await self._connection.close(code=code, reason=reason)
297300

@@ -483,6 +486,9 @@ def send(self, event: RealtimeClientEvent | RealtimeClientEventParam) -> None:
483486
)
484487
self._connection.send(data)
485488

489+
def send_raw(self, data: bytes | str) -> None:
490+
self._connection.send(data)
491+
486492
def close(self, *, code: int = 1000, reason: str = "") -> None:
487493
self._connection.close(code=code, reason=reason)
488494

src/openai/resources/responses/responses.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3632,6 +3632,9 @@ async def send(self, event: ResponsesClientEvent | ResponsesClientEventParam) ->
36323632
)
36333633
await self._connection.send(data)
36343634

3635+
async def send_raw(self, data: bytes | str) -> None:
3636+
await self._connection.send(data)
3637+
36353638
async def close(self, *, code: int = 1000, reason: str = "") -> None:
36363639
await self._connection.close(code=code, reason=reason)
36373640

@@ -3798,6 +3801,9 @@ def send(self, event: ResponsesClientEvent | ResponsesClientEventParam) -> None:
37983801
)
37993802
self._connection.send(data)
38003803

3804+
def send_raw(self, data: bytes | str) -> None:
3805+
self._connection.send(data)
3806+
38013807
def close(self, *, code: int = 1000, reason: str = "") -> None:
38023808
self._connection.close(code=code, reason=reason)
38033809

0 commit comments

Comments
 (0)