Closed roperi closed 4 months ago
This was reported earlier and it should be fixed in the latest release yesterday: https://github.com/deepgram/deepgram-python-sdk/issues/296
Can you verify it?
This was reported earlier and it should be fixed in the latest release yesterday: #296
Can you verify it?
Oops. Sorry for the duplicate. I swear i checked yesterday and couldn't find anything related (i guess i checked before it was reported).
I'll verify in a moment
No worries. You probably (hopefully) grab the SDK just before this was published.
Hmmm. It seems I already have the latest release.
pip install deepgram-sdk==3.*
Requirement already satisfied: deepgram-sdk==3.* in /home/user/.virtualenvs/Deepgram/lib/python3.10/site-packages (3.1.3)
ok. I manually did a pip install deepgram-sdk==3.1.4
and it's working now! Thanks so much! Closing the issue
all good. thanks for verifying this! good to know this is working/verified.
What is the current behavior?
In Python, everytime i want to dump the response as dictionary (i.e.
response.to_dict()
) to a json file, I get aObject of type Sentiment is not JSON serializable
error message.I noticed that the response object always fails when trying to dump the 'sentiment' key with the value 'Sentiment.UNKNOWN''
This forces me to resort to elaborate manouvers to avoid this error such as:
The checks above turn all UNKNWON sentiment values to a string and make my program work. But now that I added
topics=True
I'm once again getting the sameObject of type Sentiment is not JSON serializable
error.Why is so hard to convert a Deepgram response to a dict and dump it to a json file in Python?
Steps to reproduce
^ Fails with
Object of type Sentiment is not JSON serializable
for every Sentiment.UNKNOWN found in the response (there could be hundreds).Expected behavior
Not failing with
Object of type Sentiment is not JSON serializable
. I don't know but sentiment value should be None or "" instead of the UNKNOWN object.Please tell us about your environment
Debian 10 Python 3.10.12
Other information
This is just an excerpt of the response i'm getting (notice the sentiment value)