Closed universeroc closed 6 months ago
Hi, can you check your package.json
for the version of the SDK you are using?
Hi, can you check your
package.json
for the version of the SDK you are using?{ "name": "demo", "version": "1.0.0", "description": "", "main": "index.js", "type": "module", "scripts": { "start": "node index.mjs", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "@deepgram/sdk": "^3.0.0", "cross-fetch": "^4.0.0" } }
I imagine you were looking at a guide that uses our V2 SDK, and are using our V3 SDK which was only released yesterday. There was a moment yesterday where we could not physically update both at the same time, and unfortunately you may have fallen into that gap!
You can either re-check our docs (they're updated now) or take a look at our migration guide.
What is the current behavior?
Steps to reproduce
// The API key you created in step 1 const deepgramApiKey = '9b4e81ad9df9966d02246ccc07612405240467a1';
// URL for the real-time streaming audio you would like to transcribe const url = 'http://stream.live.vc.bbcmedia.co.uk/bbc_world_service';
// Initialize the Deepgram SDK const deepgram = new Deepgram(deepgramApiKey);
// Create a websocket connection to Deepgram const deepgramLive = deepgram.transcription.live({ smart_format: true, model: 'nova-2', language: 'en-US' });
// Listen for the connection to open and send streaming audio from the URL to Deepgram fetch(url).then(r => r.body).then(res => { res.on('readable', () => { if(deepgramLive.getReadyState() === 1) { deepgramLive.send(res.read()); } }); });
// Listen for the connection to close deepgramLive.addListener('close', () => { console.log('Connection closed.') });
// Listen for any transcripts received from Deepgram and write them to the console deepgramLive.addListener('transcriptReceived', (transcription) => { console.dir(transcription, { depth: null }); });