Skip to content

Commit 0ef36d8

Browse files
SDK regeneration
1 parent 31d6fba commit 0ef36d8

File tree

7 files changed

+26
-58
lines changed

7 files changed

+26
-58
lines changed

.fern/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"should_generate_websocket_clients": true,
1414
"enable_wire_tests": true
1515
},
16-
"sdkVersion": "6.0.0-beta.3"
16+
"sdkVersion": "6.0.0-beta.4"
1717
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dynamic = ["version"]
44

55
[tool.poetry]
66
name = "deepgram-sdk"
7-
version = "6.0.0-beta.3"
7+
version = "6.0.0-beta.4"
88
description = ""
99
readme = "README.md"
1010
authors = []

src/deepgram/agent/v1/socket_client.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ def __init__(self, *, websocket: WebSocketClientProtocol):
6161

6262
async def __aiter__(self):
6363
async for message in self._websocket:
64-
if isinstance(message, bytes):
65-
yield message
66-
else:
67-
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
64+
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
6865

6966
async def start_listening(self):
7067
"""
@@ -79,12 +76,9 @@ async def start_listening(self):
7976
await self._emit_async(EventType.OPEN, None)
8077
try:
8178
async for raw_message in self._websocket:
82-
if isinstance(raw_message, bytes):
83-
await self._emit_async(EventType.MESSAGE, raw_message)
84-
else:
85-
json_data = json.loads(raw_message)
86-
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
87-
await self._emit_async(EventType.MESSAGE, parsed)
79+
json_data = json.loads(raw_message)
80+
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
81+
await self._emit_async(EventType.MESSAGE, parsed)
8882
except (websockets.WebSocketException, JSONDecodeError) as exc:
8983
await self._emit_async(EventType.ERROR, exc)
9084
finally:
@@ -142,7 +136,7 @@ async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None:
142136
async def send_media(self, message: bytes) -> None:
143137
"""
144138
Send a message to the websocket connection.
145-
The message will be sent as bytes.
139+
The message will be sent as a bytes.
146140
"""
147141
await self._send(message)
148142

@@ -151,8 +145,6 @@ async def recv(self) -> V1SocketClientResponse:
151145
Receive a message from the websocket connection.
152146
"""
153147
data = await self._websocket.recv()
154-
if isinstance(data, bytes):
155-
return data # Binary audio data
156148
json_data = json.loads(data)
157149
return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
158150

@@ -178,10 +170,7 @@ def __init__(self, *, websocket: websockets_sync_connection.Connection):
178170

179171
def __iter__(self):
180172
for message in self._websocket:
181-
if isinstance(message, bytes):
182-
yield message
183-
else:
184-
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
173+
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
185174

186175
def start_listening(self):
187176
"""
@@ -196,12 +185,9 @@ def start_listening(self):
196185
self._emit(EventType.OPEN, None)
197186
try:
198187
for raw_message in self._websocket:
199-
if isinstance(raw_message, bytes):
200-
self._emit(EventType.MESSAGE, raw_message)
201-
else:
202-
json_data = json.loads(raw_message)
203-
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
204-
self._emit(EventType.MESSAGE, parsed)
188+
json_data = json.loads(raw_message)
189+
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
190+
self._emit(EventType.MESSAGE, parsed)
205191
except (websockets.WebSocketException, JSONDecodeError) as exc:
206192
self._emit(EventType.ERROR, exc)
207193
finally:
@@ -259,7 +245,7 @@ def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None:
259245
def send_media(self, message: bytes) -> None:
260246
"""
261247
Send a message to the websocket connection.
262-
The message will be sent as bytes.
248+
The message will be sent as a bytes.
263249
"""
264250
self._send(message)
265251

@@ -268,8 +254,6 @@ def recv(self) -> V1SocketClientResponse:
268254
Receive a message from the websocket connection.
269255
"""
270256
data = self._websocket.recv()
271-
if isinstance(data, bytes):
272-
return data # Binary audio data
273257
json_data = json.loads(data)
274258
return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
275259

src/deepgram/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ def __init__(
2323

2424
def get_headers(self) -> typing.Dict[str, str]:
2525
headers: typing.Dict[str, str] = {
26-
"User-Agent": "deepgram-sdk/6.0.0-beta.3",
26+
"User-Agent": "deepgram-sdk/6.0.0-beta.4",
2727
"X-Fern-Language": "Python",
2828
"X-Fern-SDK-Name": "deepgram-sdk",
29-
"X-Fern-SDK-Version": "6.0.0-beta.3",
29+
"X-Fern-SDK-Version": "6.0.0-beta.4",
3030
**(self.get_custom_headers() or {}),
3131
}
3232
headers["Authorization"] = f"Token {self.api_key}"

src/deepgram/listen/v1/socket_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def start_listening(self):
5757
async def send_media(self, message: bytes) -> None:
5858
"""
5959
Send a message to the websocket connection.
60-
The message will be sent as bytes.
60+
The message will be sent as a bytes.
6161
"""
6262
await self._send(message)
6363

@@ -138,7 +138,7 @@ def start_listening(self):
138138
def send_media(self, message: bytes) -> None:
139139
"""
140140
Send a message to the websocket connection.
141-
The message will be sent as bytes.
141+
The message will be sent as a bytes.
142142
"""
143143
self._send(message)
144144

src/deepgram/listen/v2/socket_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def start_listening(self):
5454
async def send_media(self, message: bytes) -> None:
5555
"""
5656
Send a message to the websocket connection.
57-
The message will be sent as bytes.
57+
The message will be sent as a bytes.
5858
"""
5959
await self._send(message)
6060

@@ -121,7 +121,7 @@ def start_listening(self):
121121
def send_media(self, message: bytes) -> None:
122122
"""
123123
Send a message to the websocket connection.
124-
The message will be sent as bytes.
124+
The message will be sent as a bytes.
125125
"""
126126
self._send(message)
127127

src/deepgram/speak/v1/socket_client.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ def __init__(self, *, websocket: WebSocketClientProtocol):
3232

3333
async def __aiter__(self):
3434
async for message in self._websocket:
35-
if isinstance(message, bytes):
36-
yield message
37-
else:
38-
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
35+
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
3936

4037
async def start_listening(self):
4138
"""
@@ -50,12 +47,9 @@ async def start_listening(self):
5047
await self._emit_async(EventType.OPEN, None)
5148
try:
5249
async for raw_message in self._websocket:
53-
if isinstance(raw_message, bytes):
54-
await self._emit_async(EventType.MESSAGE, raw_message)
55-
else:
56-
json_data = json.loads(raw_message)
57-
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
58-
await self._emit_async(EventType.MESSAGE, parsed)
50+
json_data = json.loads(raw_message)
51+
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
52+
await self._emit_async(EventType.MESSAGE, parsed)
5953
except (websockets.WebSocketException, JSONDecodeError) as exc:
6054
await self._emit_async(EventType.ERROR, exc)
6155
finally:
@@ -94,8 +88,6 @@ async def recv(self) -> V1SocketClientResponse:
9488
Receive a message from the websocket connection.
9589
"""
9690
data = await self._websocket.recv()
97-
if isinstance(data, bytes):
98-
return data # Binary audio data
9991
json_data = json.loads(data)
10092
return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
10193

@@ -121,10 +113,7 @@ def __init__(self, *, websocket: websockets_sync_connection.Connection):
121113

122114
def __iter__(self):
123115
for message in self._websocket:
124-
if isinstance(message, bytes):
125-
yield message
126-
else:
127-
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
116+
yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore
128117

129118
def start_listening(self):
130119
"""
@@ -139,12 +128,9 @@ def start_listening(self):
139128
self._emit(EventType.OPEN, None)
140129
try:
141130
for raw_message in self._websocket:
142-
if isinstance(raw_message, bytes):
143-
self._emit(EventType.MESSAGE, raw_message)
144-
else:
145-
json_data = json.loads(raw_message)
146-
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
147-
self._emit(EventType.MESSAGE, parsed)
131+
json_data = json.loads(raw_message)
132+
parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
133+
self._emit(EventType.MESSAGE, parsed)
148134
except (websockets.WebSocketException, JSONDecodeError) as exc:
149135
self._emit(EventType.ERROR, exc)
150136
finally:
@@ -183,8 +169,6 @@ def recv(self) -> V1SocketClientResponse:
183169
Receive a message from the websocket connection.
184170
"""
185171
data = self._websocket.recv()
186-
if isinstance(data, bytes):
187-
return data # Binary audio data
188172
json_data = json.loads(data)
189173
return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore
190174

0 commit comments

Comments
 (0)