Comments (8)
This is happening to me too in Macos Ventura 13.4.1 (c) (22F770820d)
The weird thing is the first time I ran the example, everything went well. Now that I wanted to re run it, I'm receiving this error.
from deepgram-python-sdk.
Were you using Docker? If so, which image were you using?
from deepgram-python-sdk.
It happens here sometimes too. Linux mint 20.
Edit: Using it asynchronously worked without any problems.
response = await dg_client.transcription.prerecorded(source, options)
from deepgram-python-sdk.
I got the same error (Ubuntu, Python 3.11).
A quick way to reproduce this is to send a prerecorded request to a whisper model with the keywords=Whisper
parameter. Because the whisper models (veeeeeeeheeeery unfortunately ;)) do not support the keywords
feature, the API will return a 400:
{
"err_code": "INVALID_QUERY_PARAMETER",
"err_msg": "When using Whisper, keywords are not available.",
"request_id": "..."
}
When you do this async with response = await dg_client.transcription.prerecorded(source, options)
, an exception is raised that at least hints you into the right direction, even if it doesn't convey the more informative err_msg
:
Traceback (most recent call last):
...
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api.deepgram.com/v1/listen?model=whisper-medium&keywords=Whisper')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
Exception: DG: 400, message='Bad Request', url=URL('https://api.deepgram.com/v1/listen?model=whisper-medium&keywords=Whisper')
However, when you do this sync with response = dg_client.transcription.sync_prerecorded(source, options)
, the quite misleading exception shown below is raised:
Traceback (most recent call last):
...
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2423)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:2423)>
The expected result would be that the same thing happens for the client user when hitting a 400, whether the call was made async or sync.
Also I'd like to add two personal preferences:
- I would prefer it if there was an option to return the error response instead of raising an exception, so that I can check the status code and a potential error message of the response on my own.
- The client library doesn't implement its own exception classes here, but instead raises the most basic Exception class with a more or less cryptic message:
raise (Exception(f'DG: {exc}') if exc.status < 500 else exc)
. For convenient error handling in downstream applications, most client libraries implement custom exceptions, with well differentiated and speaking class names. The current implementation forces the client user toexcept Exception
, which will (like a bare catch) subsume every possible exception that could occur. This makes error handling more complicated.
from deepgram-python-sdk.
from deepgram-python-sdk.
Hi @shershen08
The Python SDK is going through a major overhaul right now. If you had a moment to check against the code in main
branch, that would be helpful. I'm hoping at least minimally, the exception message is significantly improved. We can start with that and go from there.
from deepgram-python-sdk.
Hi @shershen08. The alpha.5
release is out. Can you please retry with this release and see if you run into the same problem?
from deepgram-python-sdk.
Closing due to inactivity. If there is still a problem with the latest release, please reopen or file a new issue. thanks!
from deepgram-python-sdk.
Related Issues (20)
- Introduce v1.1 for Speak Clients (REST + WS) HOT 1
- Refactor Similar Code in REST and WS Clients HOT 1
- httpcore.ReadTimeout: The read operation timed out HOT 3
- Microphone Package/Library Isn't Supported on Windows HOT 5
- websocket send function is not processing subsequent messages HOT 12
- `endpointing` attribute in `LiveOptions` should be a union integer and a generic false. HOT 1
- Missing `dictation` setting from streaming audio (live) `LiveOptions`
- Improved API Reference HOT 6
- Request for Sample Code or sample project: Live Transcription from Microphone HOT 2
- Dictation feature does not work when punctuation characters are spoken after a pause HOT 2
- Async client live transcribing on_message not called HOT 7
- Async transcription issue HOT 8
- Manual End of Speech HOT 3
- Latest release 3.5.0 includes tests package
- on_message doesn't return after adding supabase client call HOT 11
- tests directory is a module unto itself causing import errors for any project with a local tests directory HOT 2
- Error Occurs When Retrieving Usage Information Due to Delay in Data Availability HOT 4
- Unused Variable Due to Typo in Output Statement in `examples/manage/usage/main.py` HOT 3
- `TypeError Due to Unexpected Keyword Argument in `PrerecordedOptions` Initialization` HOT 7
- DeepgramApiError is not in the python SDK HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepgram-python-sdk.