@@ -41,65 +41,6 @@ tests/wire/__init__.py
4141# Manual standalone tests
4242tests/manual
4343
44- # WebSocket socket client files with manual fixes for binary audio data support:
45- # The generator incorrectly types media methods as `str` and uses `_send_model()` which calls
46- # `.dict()` on the input, causing runtime errors. Additionally, response types and recv/iterator
47- # methods don't handle binary audio data properly. These files are manually fixed to:
48- # 1. Change parameter type from `str` to `bytes` for `send_media()` methods
49- # 2. Change from `_send_model()` to `_send()` to properly handle binary data
50- # 3. Change response union types from `str` to `bytes` where binary audio is received
51- # 4. Update recv(), __iter__(), __aiter__(), and start_listening() methods to handle both
52- # binary bytes and JSON text messages
53- #
54- # src/deepgram/listen/v1/socket_client.py:
55- # - Line 57: Changed `async def send_media(self, message: str)` to `message: bytes`
56- # - Line 60: Updated docstring from "sent as a str" to "sent as bytes"
57- # - Line 62: Changed `await self._send_model(message)` to `await self._send(message)`
58- # - Line 138: Changed `def send_media(self, message: str)` to `message: bytes`
59- # - Line 141: Updated docstring from "sent as a str" to "sent as bytes"
60- # - Line 143: Changed `self._send_model(message)` to `self._send(message)`
61- # Note: Listen V1 only sends binary audio, receives JSON transcriptions (no binary response handling needed)
62- #
63- # src/deepgram/listen/v2/socket_client.py:
64- # - Line 54: Changed `async def send_media(self, message: str)` to `message: bytes`
65- # - Line 57: Updated docstring from "sent as a str" to "sent as bytes"
66- # - Line 59: Changed `await self._send_model(message)` to `await self._send(message)`
67- # - Line 121: Changed `def send_media(self, message: str)` to `message: bytes`
68- # - Line 124: Updated docstring from "sent as a str" to "sent as bytes"
69- # - Line 126: Changed `self._send_model(message)` to `self._send(message)`
70- # Note: Listen V2 only sends binary audio, receives JSON transcriptions (no binary response handling needed)
71- #
72- # src/deepgram/agent/v1/socket_client.py:
73- # - Line 53: Changed response union from `str` to `bytes` for binary audio responses
74- # - Line 62-67: Updated `__aiter__()` to check `isinstance(message, bytes)` before JSON parsing
75- # - Line 81-87: Updated `start_listening()` to handle binary messages in async loop
76- # - Line 142-147: Added `async def send_media(self, message: bytes)` method (was missing from generator)
77- # - Line 149-157: Updated `recv()` to check `isinstance(data, bytes)` before JSON parsing
78- # - Line 179-184: Updated `__iter__()` to check `isinstance(message, bytes)` before JSON parsing
79- # - Line 198-204: Updated `start_listening()` to handle binary messages in sync loop
80- # - Line 259-264: Added `def send_media(self, message: bytes)` method (was missing from generator)
81- # - Line 266-274: Updated `recv()` to check `isinstance(data, bytes)` before JSON parsing
82- # Reason: Agent API sends binary audio input and receives binary audio output + JSON events
83- #
84- # src/deepgram/speak/v1/socket_client.py:
85- # - Line 25: Changed response union from `str` to `bytes` for binary audio responses
86- # - Line 33-38: Updated `__aiter__()` to check `isinstance(message, bytes)` before JSON parsing
87- # - Line 52-57: Updated `start_listening()` to handle binary messages in async loop
88- # - Line 90-94: Updated `recv()` to check `isinstance(data, bytes)` before JSON parsing
89- # - Line 115-120: Updated `__iter__()` to check `isinstance(message, bytes)` before JSON parsing
90- # - Line 135-141: Updated `start_listening()` to handle binary messages in sync loop
91- # - Line 177-181: Updated `recv()` to check `isinstance(data, bytes)` before JSON parsing
92- # Reason: Speak API sends JSON text commands and receives binary audio output + JSON metadata
93- #
94- # General reason: Audio data must be sent/received as binary bytes, not strings. The `_send_model()`
95- # method expects Pydantic models and calls `.dict()` which fails on bytes. The `_send()` method
96- # properly handles bytes by passing them directly to the websocket connection. Response handling
97- # must distinguish between binary audio data and JSON text messages.
98- src/deepgram/listen/v1/socket_client.py
99- src/deepgram/listen/v2/socket_client.py
100- src/deepgram/agent/v1/socket_client.py
101- src/deepgram/speak/v1/socket_client.py
102-
10344# Folders to ignore
10445.github
10546docs
0 commit comments