DEV Community

Discussion on: Deepgram x DEV Hackathon Help Thread

Collapse
 
michaeljolley profile image
Michael Jolley

Great question. It depends on how you're hitting the API. If you are using the Node SDK you'd use the finish function, as in:

const deepgramSocket = deepgram.transcription.live({ punctuate: true });
deepgramSocket.finish();
Enter fullscreen mode Exit fullscreen mode

If you're communicating with the WebSocket directly with JavaScript you can send a new Uint8Array, as in:

socket.send(new Uint8Array(0));
Enter fullscreen mode Exit fullscreen mode

When the Deepgram API receives that it will finish transcribing the audio, send a final transcript, and then close the WebSocket connection.

Collapse
 
pythonperfection profile image
Eli Ostreicher

Appreciate the response.
What about good old Python please?

P.S. Great Twitch btw, really enjoyed it.

Thread Thread
 
michaeljolley profile image
Michael Jolley

Thanks!

For the Python SDK:

deepgramLive = await deepgram.transcription.live()
await deepgramLive.finish()
Enter fullscreen mode Exit fullscreen mode

Against the WebSocket without the SDK would be something like:

await socket.send(b'')
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
bekahhw profile image
BekahHW • Edited

Thanks for coming to the stream today!