Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/deepgram/agent/v1/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def __init__(self, *, websocket: WebSocketClientProtocol):

def _is_binary_message(self, message: typing.Any) -> bool:
"""Determine if a message is binary data."""
return isinstance(message, (bytes, bytearray))
# Use type() directly for consistent performance (avoids isinstance+tuple overhead for simple cases),
# but preserves behavioral correctness for both bytes/bytearray
t = type(message)
return t is bytes or t is bytearray

def _handle_binary_message(self, message: bytes) -> typing.Any:
"""Handle a binary message (returns as-is for audio chunks)."""
Expand Down