deepgram / deepgram-python-sdk

Official Python SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
214 stars 58 forks source link

Error Occurs When Retrieving Usage Information Due to Delay in Data Availability #457

Open Viamo opened 2 weeks ago

Viamo commented 2 weeks ago

What is the current behavior?

When calling deepgram.listen.prerecorded.v('1').transcribe_file(payload, options) followed immediately by deepgram.manage.v('1').get_usage_request(DEEPGRAM_PROJECT_ID, requestId), an error occurs in the file client.py at line 1004. The variable result has a value of None.

Steps to reproduce

  1. Call deepgram.listen.prerecorded.v('1').transcribe_file(payload, options).
  2. Immediately call deepgram.manage.v('1').get_usage_request(DEEPGRAM_PROJECT_ID, requestId) with DEEPGRAM_PROJECT_ID and requestId.

Expected behavior

The get_usage_request function should return valid usage information without returning None, and the package should handle the error if the data is not available yet.

Please tell us about your environment

Other information

The issue appears to be related to the delay in retrieving usage information. Even if the information is unavailable, the error should still be handled properly by the package.

dvonthenen commented 1 week ago

I looked into this, and it is an API issue. I will forward it to engineering, as the API should return an error instead of a result.

In the meantime, I would recommend checking for the null value in the result to determine data availability if you have a need for the API that quickly; otherwise, will need to wait for this fix in the API.

Viamo commented 1 week ago

The variable result is not accessible because it is inside the package. The only way is to give up on the SDK and access the API directly, but for now, I just added sleep().

dvonthenen commented 1 week ago

The variable result is not accessible because it is inside the package. The only way is to give up on the SDK and access the API directly, but for now, I just added sleep().

Let me take a look at this and see what I can do.

Viamo commented 1 week ago

Thank you for the help. I'm using sleep(), and that’s sufficient for now. It would be great if you could address the errors at your end. Thanks!