Skip to content
Draft
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://github.com/deepgram-starters/node-text-intelligence#readme",
"dependencies": {
"@deepgram/sdk": "4.11.3",
"@deepgram/sdk": "5.0.0-beta.4",
"cors": "2.8.5",
"dotenv": "17.2.3",
"express": "5.2.1",
Expand All @@ -52,4 +52,4 @@
"last 1 safari version"
]
}
}
}
93 changes: 5 additions & 88 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 4 additions & 17 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

require("dotenv").config();

const { createClient } = require("@deepgram/sdk");
const { DeepgramClient } = require("@deepgram/sdk");
const cors = require("cors");
const crypto = require("crypto");
const express = require("express");
Expand Down Expand Up @@ -100,7 +100,7 @@ function loadApiKey() {
const apiKey = loadApiKey();

// Initialize Deepgram client
const deepgram = createClient(apiKey);
const deepgram = new DeepgramClient({ apiKey });

// Initialize Express app
const app = express();
Expand Down Expand Up @@ -269,21 +269,8 @@ app.post('/api/text-intelligence', requireSession, async (req, res) => {
options.intents = true;
}

// Call Deepgram API (SDK v4 returns { result, error })
const { result, error } = await deepgram.read.analyzeText({ text: textContent }, options);

// Handle SDK errors
if (error) {
console.error('Deepgram API Error:', error);
return res.status(400).json({
error: {
type: "processing_error",
code: "INVALID_TEXT",
message: error.message || 'Failed to process text',
details: {}
}
});
}
// Call Deepgram API (SDK v5 throws on error)
const result = await deepgram.read.v1.text.analyze({ ...options, body: { text: textContent } });

// Return full results object (includes all requested features)
res.json({
Expand Down