SuperAPI AI 工具集

deepgram-python-audio-intelligence

编程与开发

查看项目

更新于 10-16 05:05

技能介绍

用途:该技能面向在 Python 项目中调用 Deepgram 音频智能(Audio Intelligence)的场景,即在 /v1/listen 转写的同时获得分析结果,适用于已有音频文件、URL 或实时流的分析需求。REST 是主要路径,多数分析功能仅 REST 支持。

主要能力:summarize(摘要)、topics(主题)、intents(意图)、sentiment(情感)、detect_language(语言检测)、diarize(说话人分离)、redact(脱敏)、实体识别(detect_entities),以及自定义 custom_topic / custom_intent 及其 mode。REST 与 WSS 支持范围不同:diarize、redact、punctuate、smart_format、实体检测两者均支持;summarize、topics、intents、sentiment、detect_language、custom_topic、custom_intent 仅 REST 支持。

使用方式:通过环境变量加载密钥后创建 client = DeepgramClient(),鉴权头为 Authorization: Token <api_key>。REST 可用 transcribe_url 或 transcribe_file,例如 client.listen.v1.media.transcribe_url(url=..., model="nova-3", smart_format=True, punctuate=True, diarize=True, summarize="v2", topics=True, intents=True, sentiment=True, detect_language=True, redact=["pci", "pii"], language="en-US"),结果从 response.results 读取 transcript、summary、topics、intents、sentiments 及 detected_language。说话人分离可设置 utterances=True 或 paragraphs=True 获得分组视图;WSS 子集使用 client.listen.v1.connect(...) 并配合事件监听与 send_media / send_finalize。

限制:sentiment、topics、intents、summarize、detect_language 为 REST 专用且仅支持英语;并非所有模型支持全部叠加功能,Flux / Base 有较多限制,通常建议使用 nova-3。redact 取值应为 pci、pii、phi、numbers 等固定值;custom_topic / custom_intent 需指定 "extended" 或 "strict" 模式。当前生成的 SDK 中 redact 类型为 Optional[str],多模式脱敏需按查询参数重复传递或分多次调用。说话人分离在短音频或低质量音频上不稳定,30 秒以内片段可能出现说话人跳变。