UPDATE
I found the issue regarding the error above; the utterance_end_ms parameter value cannot be <1000.
The documentation mentions that it's not recommended:
documentation
In practice, you should set the value of utterance_end_ms to be 1000 ms or higher. Deepgram's Interim Results are typically sent every 1 second, so using a value of less than 1 second will not offer any benefits.
however, having a utternance_end_ms value <1000 yields a 400 bad request and I think Deepgram's error handling could be more informative.
I had to do some digging to to get the raw response:
HTTP/1.1 400 Bad Request'
status_code 400 reason Bad Request headers content-type: application/json
dg-error: Invalid 'utterance_end_ms' value of '999'.
content-length: 145
dg-request-id: 587b3227-f6ca-4818-bb4d-028182adf4ea
...
After adjusting the utterance_end_ms to 1000 and changing self.dg_connection = self.deepgram_client.listen.live.v("1") to self.dg_connection = self.deepgram_client.listen.asynclive.v("1") then i'm getting this error:
deepgram/clients/live/v1/async_client.py:219: RuntimeWarning: coroutine 'AsyncLiveClient._emit' was never awaited
self._emit(LiveTranscriptionEvents.Error, error)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Task exception was never retrieved
future: <Task finished name='Task-16' coro=<AsyncLiveClient._start() done, defined at deepgram/clients/live/v1/async_client.py:97>
Traceback (most recent call last):
File "deepgram/clients/live/v1/async_client.py", line 114, in _start
await self._emit(
File "deepgram/clients/live/v1/async_client.py", line 95, in _emit
await handler(self, *args, **kwargs)
TypeError: object NoneType can't be used in 'await' expression