Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/sample/deepgram/.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage/
package-lock.json
test
25 changes: 25 additions & 0 deletions packages/sample/deepgram/deepgram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { createClient } = require("@deepgram/sdk");
require("dotenv").config();

async function transcribeUrl(args) {
// STEP 1: Create a Deepgram client using the API key
const deepgram = createClient(process.env.DEEPGRAM_API_KEY);

// STEP 2: Call the transcribeUrl method with the audio payload and options
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
{
url: args.url,
},
// STEP 3: Configure Deepgram options for audio analysis
{
model: "nova-2",
smart_format: true,
}
);

if (error) throw error;
// STEP 4: Print the results
if (!error) console.dir(result, { depth: null });
}

exports.main = transcribeUrl;
6 changes: 6 additions & 0 deletions packages/sample/deepgram/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"@deepgram/sdk": "^3.1.9",
"dotenv": "^16.4.5"
}
}