How to get best two 'alternatives' in Deepgram Self-hosted Streaming speech-to-text setup #1022
-
Hi, My setup is:
Basically I want to get two best probabilities for transcription. For example in below reply the best on is with confidence: 0.95265996 Stack is React and Python FastAPI Request ID: 151c83cd-94c1-4c0a-bc2a-26193729e887 I get sample response: Full response from Deepgram: {'type': 'Results', 'channel_index': [0, 1], 'duration': 1.79, 'start': 2.67, 'is_final': True, 'speech_final': True, 'channel': {'alternatives': [{'transcript': 'Hello. Hello. Hello. Can you hear me?', 'confidence': 0.95265996, 'words': [{'word': 'hello', 'start': 2.91, 'end': 3.23, 'confidence': 0.8148965, 'speaker': 0, 'punctuated_word': 'Hello.'}, {'word': 'hello', 'start': 3.23, 'end': 3.5500002, 'confidence': 0.952556, 'speaker': 0, 'punctuated_word': 'Hello.'}, {'word': 'hello', 'start': 3.5500002, 'end': 3.63, 'confidence': 0.83288157, 'speaker': 0, 'punctuated_word': 'Hello.'}, {'word': 'can', 'start': 3.63, 'end': 3.79, 'confidence': 0.95265996, 'speaker': 0, 'punctuated_word': 'Can'}, {'word': 'you', 'start': 3.79, 'end': 4.11, 'confidence': 0.9997596, 'speaker': 0, 'punctuated_word': 'you'}, {'word': 'hear', 'start': 4.11, 'end': 4.19, 'confidence': 0.99995744, 'speaker': 0, 'punctuated_word': 'hear'}, {'word': 'me', 'start': 4.19, 'end': 4.46, 'confidence': 0.99896395, 'speaker': 0, 'punctuated_word': 'me?'}]}]}, 'metadata': {'request_id': '151c83cd-94c1-4c0a-bc2a-26193729e887', 'model_info': {'name': '2-medical-nova', 'version': '2024-06-11.4692', 'arch': 'nova-2'}, 'model_uuid': '46658e06-4884-4582-9bc2-e92ef7baa396'}, 'from_finalize': False} I am looking for an option to get top two transcription 'alternatives' as response, instead of just one: I tried: However, doesn't look like it's a correct option and DG stop sending transcription if I use alternatives option in it. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hey there! It looks like you haven't connected your GitHub account to your Deepgram account. You can do this at https://community.deepgram.com - being verified through this process will allow our team to help you in a much more streamlined fashion. |
Beta Was this translation helpful? Give feedback.
-
Looking at our logs I'm seeing you sent a request as:
And I see this error: We have a deprecated feature called Here's a reference to the <https://github.com/deepgram/deepgram-js-sdk/blob/18b46406d288d076f57a909b76c590910a96ec2a/src/lib/types/SyncPrerecordedResponse.ts#L6|alternatives interface> in our JS SDK so to make this request try to get an alternative transcript try:
It should still work, but like I said it's technical a deprecated feature we haven't yet removed from our API.
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
I did some testing, It seems Alternatives does work for our older models specifically
nova
,base
,enhanced
NOTnova-2
. Also instead oftrue
you'd need to pass in an integer value for the number of alternatives you want back.Here's an example cURL that worked for me: