mcpField
D
deepgram-js-audio-intelligence

deepgram-js-audio-intelligence

github.com/deepgram数据与数据库27759 次安装今天更新
代码仓库

关于 deepgram-js-audio-intelligence

面向 JavaScript/TypeScript 开发者的技能,可在 Deepgram 音频转录中启用音频分析功能,涵盖 REST 分析及 WebSocket 支持的部分功能。

主要功能

  1. 01摘要、主题和意图分析
  2. 02情感与语言检测
  3. 03说话人分离与信息脱敏
  4. 04转录时检测实体

适用场景

  1. 01结合转录分析音频
  2. 02识别录音中的说话人
  3. 03对转录中的敏感数据脱敏

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/deepgram/deepgram-js-sdk --skill deepgram-js-audio-intelligence

安装后在 Claude Code 中输入/deepgram-js-audio-intelligence确认已加载。

详细介绍

使用 Deepgram Audio Intelligence(JavaScript / TypeScript SDK)

应用于 /v1/listen 的分析增强功能:摘要、主题、意图、情感、语言检测、说话人分离、脱敏、实体识别。使用与 STT 相同的客户端接口;通过参数启用这些功能。

何时使用此产品

  • 你有音频,并希望在返回转录文本的同时获得分析结果。
  • REST 是主要路径;WebSocket 路径仅支持部分智能功能。

以下情况请使用其他技能:

  • 你只需要转录文本输出 → deepgram-js-speech-to-text。
  • 你已有文本,想对其进行分析 → deepgram-js-text-intelligence。
  • 你需要 Flux 轮流发言功能 → deepgram-js-conversational-stt。
  • 你需要完整的交互式语音 Agent → deepgram-js-voice-agent。

功能支持情况:REST 与 WSS

功能RESTWSS
diarize是是
redact是是
detect_entities是是
punctuate, smart_format是是
summarize是当前 WSS 连接参数中不支持
topics是否
intents是否
sentiment是否
detect_language是否

身份验证

require("dotenv").config();

const { DeepgramClient } = require("@deepgram/sdk");

const deepgramClient = new DeepgramClient({
  apiKey: process.env.DEEPGRAM_API_KEY,
});

快速入门 — 使用分析功能的 REST

摘自 examples/22-transcription-advanced-options.ts:

const data = await deepgramClient.listen.v1.media.transcribeUrl({
  url: "https://dpgr.am/spacewalk.wav",
  model: "nova-3",
  language: "en",
  punctuate: true,
  paragraphs: true,
  utterances: true,
  smart_format: true,
  sentiment: true,
  topics: true,
  custom_topic: "custom_topic",
  custom_topic_mode: "extended",
  intents: true,
  custom_intent: "custom_intent",
  custom_intent_mode: "extended",
  detect_entities: true,
  detect_language: true,
  diarize: true,
  keyterm: ["keyword1", "keyword2"],
  redact: ["pci", "ssn"],
});

快速入门 — WSS 子集

从 examples/07-transcription-live-websocket.ts 开始,保留相同的套接字流程,但在连接参数中仅使用 WSS 支持的智能功能标志,例如 diarize、redact 和 detect_entities。

const deepgramConnection = await deepgramClient.listen.v1.createConnection({
  model: "nova-3",
  diarize: true,
  redact: "pci",
  detect_entities: true,
});

关键参数 / API 接口

  • 分析功能标志:summarize、topics、intents、sentiment、detect_language、detect_entities、diarize、redact、custom_topic、custom_topic_mode、custom_intent、custom_intent_mode。
  • 标准 STT 标志仍然适用:model、language、encoding、sample_rate、punctuate、smart_format、utterances、paragraphs、multichannel。
  • 仓库中的 Nova-3 专用偏置示例使用 keyterm,而不是 keywords。

API 参考(分层)

  1. 仓库内参考:reference.md → Listen V1 Media;WSS 子集行为见 src/CustomClient.ts 和 src/api/resources/listen/resources/v1/client/{Client,Socket}.ts。
  2. 规范 OpenAPI(REST):https://developers.deepgram.com/openapi.yaml
  3. 规范 AsyncAPI(WSS):https://developers.deepgram.com/asyncapi.yaml
  4. Context7:库 ID /llmstxt/developers_deepgram_llms_txt
  5. 产品文档:

注意事项

  1. **/v1/listen 上的 summarize 是有版本号的,并非普通布尔值。**生成的 REST 接口和示例都指向 "v2"。
  2. **大多数智能功能标志仅适用于 REST。**当前 WSS 连接参数不提供 topics、intents、sentiment、summarize 或 detect_language。
  3. **实际使用中,redact 的类型比生成的别名定义更宽松。**示例会传入 ["pci", "ssn"] 这样的数组,尽管 ListenV1Redact 本身只是一个字符串别名。
  4. Nova-3 偏置请使用 keyterm。examples/22-transcription-advanced-options.ts 明确指出 Nova-3 不支持 keywords。
  5. **模型 / 功能支持情况取决于产品端。**混用多种增强功能时,nova-3 是最稳妥的选择。
  6. **说话人分离的质量取决于音频质量和时长。**较短或嘈杂的片段会导致说话人识别结果频繁变化。

此仓库中的示例文件

  • examples/22-transcription-advanced-options.ts
  • examples/04-transcription-prerecorded-url.ts
  • examples/05-transcription-prerecorded-file.ts
  • examples/07-transcription-live-websocket.ts

核心产品技能

如需跨语言的 Deepgram 产品知识——整合的 API 参考、文档查找器、专注且可运行的示例、第三方集成示例以及 MCP 配置,请安装核心技能:

npx skills add deepgram/skills

此 SDK 提供符合各语言习惯的代码技能;deepgram/skills 提供跨语言的产品知识(参见 api、docs、recipes、examples、starters、setup-mcp)。

评论

支持 Markdown