deepgram-python-text-intelligence
このリポジトリ内でPythonコードを作成・レビューする際に使用します。Deepgram Text Intelligence / Read(`/v1/read`)APIを呼び出して、テキスト入力に対するセンチメント分析、要約、トピック検出、インテント認識を実行できます。`text`または`url`をボディとした`client.read.v1.text.analyze(...)`に対応しています。音声ソースの場合は、代わりに`deepgram-python-audio-intelligence`を使用してください。「read API」「text intelligence」「analyze text」「sentiment」「summarize text」「topics」「intents」「read.v1」といったキーワードで起動します。
description の原文を見る
Use when writing or reviewing Python code in this repo that calls Deepgram Text Intelligence / Read (`/v1/read`) for sentiment, summarization, topic detection, and intent recognition on text input. Covers `client.read.v1.text.analyze(...)` with body `text` or `url`. Use `deepgram-python-audio-intelligence` when the source is audio instead of text. Triggers include "read API", "text intelligence", "analyze text", "sentiment", "summarize text", "topics", "intents", "read.v1".
SKILL.md 本文
Deepgram Text Intelligence (Python SDK) の使用
/v1/read を経由して、プレーンテキスト(またはホストされているテキストURL)を分析し、感情、要約、トピック、インテントを抽出します。
このプロダクトを使用する場合
- テキストが既に存在する(トランスクリプト、ドキュメント、チャットログ、メール)があり、分析が必要
- 迅速な1回限りの分析が必要 — REST のみで、ストリーミングなし
別のスキルを使用する場合:
- ソースがオーディオで、分析オーバーレイが必要 →
deepgram-python-audio-intelligence(同じ分析を文字起こし時に適用)
認証
from dotenv import load_dotenv
load_dotenv()
from deepgram import DeepgramClient
client = DeepgramClient()
ヘッダー: Authorization: Token <api_key>
クイックスタート
response = client.read.v1.text.analyze(
request={"text": "Hello, world! This is a sample text for analysis."},
language="en",
sentiment=True,
summarize=True, # /v1/read はブール値のみ(注意事項を参照)
topics=True,
intents=True,
)
if response.results.sentiments:
print("sentiment avg:", response.results.sentiments.average)
if response.results.summary:
print("summary:", response.results.summary.text)
if response.results.topics:
print("topics:", response.results.topics.segments)
if response.results.intents:
print("intents:", response.results.intents.segments)
request={"text": "..."} でプレーンテキストを渡すか、request={"url": "https://..."} でホストされているプレーンテキストドキュメントを渡します。
非同期版
from deepgram import AsyncDeepgramClient
client = AsyncDeepgramClient()
response = await client.read.v1.text.analyze(request={"text": "..."}, language="en", sentiment=True)
主要パラメータ
| パラメータ | 型 | 説明 |
|---|---|---|
request | {"text": str} または {"url": str} | いずれか1つが必須 |
language | str | ほとんどの分析機能で必須。現在は英語のみ。 |
sentiment | bool | セグメントごとの感情分析 + 平均感情スコア |
summarize | bool | /v1/read はブール値のみを受け入れます。SDKの型エイリアス TextAnalyzeRequestSummarize = typing.Union[typing.Literal["v2"], typing.Any] は Listen と共有されており、Read が実際に対応しているものより広い — analyze メソッドのドキュメント文字列には「Read API の場合、ブール値のみを受け入れます」と記載されています。(Listen の summarize="v2" は異なるプロダクト — deepgram-python-audio-intelligence を参照) |
topics | bool | セグメントごとのトピック検出 |
intents | bool | セグメントごとのインテント認識 |
custom_topic / custom_topic_mode | list[str] / str | ユーザー定義トピック |
custom_intent / custom_intent_mode | list[str] / str | ユーザー定義インテント |
callback, callback_method, tag | 非同期コールバック + メタデータ |
レスポンス形式(抜粋)
response.results.summary.text
response.results.sentiments.segments[]
response.results.sentiments.average
response.results.topics.segments[]
response.results.intents.segments[]
response.metadata
完全な形式は reference.md → 「Read V1 Text」を参照してください。リクエストボディモデル: ReadV1RequestParams
API リファレンス(レイヤー化)
- リポジトリ内リファレンス:
reference.md— 「Read V1 Text」 - OpenAPI (REST): https://developers.deepgram.com/openapi.yaml
- Context7: ライブラリID
/llmstxt/developers_deepgram_llms_txt - プロダクトドキュメント:
注意事項
Token認証を使用、Bearerではなく。- 英語のみ — 現在、感情分析 / 要約 / トピック / インテントは英語のみ対応
/v1/readのsummarizeはブール値のみ。TrueまたはFalseを渡してください。/v1/readに"v2"を渡さないでください — これは Listen のみのオプション(deepgram-python-audio-intelligenceを参照)。SDKの型Union[Literal["v2"], Any]は Listen と共有されており、Read が実際に受け入れるものより広い。analyzeドキュメント文字列は以下のように明記しています:「Read API の場合、ブール値のみを受け入れます」。モックサーバーに対してsummarize="v2"を渡す生成されたワイヤーテストは Fern の成果物であり、実際の/v1/readサポートを示していません。languageは必須 — 上記のゲーティングされた分析機能用- 本文は JSON
request=— クエリパラメータではありません。/v1/listenと混同しないでください。/v1/listenは本文にオーディオを受け取ります。 - カスタムトピック/インテントにはモードが必要 (
custom_topic_mode="extended","strict") — ない場合は無視されます。
このリポジトリのファイル例
examples/40-text-intelligence.pytests/wire/test_read_v1_text.py
中央プロダクトスキル
言語横断的な Deepgram プロダクト知識 — 統合 API リファレンス、ドキュメント検索機能、フォーカスされた実行可能なレシピ、サードパーティ統合例、および MCP セットアップ — 中央スキルをインストール:
npx skills add deepgram/skills
このSDKは言語固有のコードスキルを提供します。deepgram/skills は言語横断的なプロダクト知識を提供します(api、docs、recipes、examples、starters、setup-mcp を参照)。
ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ
詳細情報
- 作者
- deepgram
- ライセンス
- MIT
- 最終更新
- 2026/5/12
Source: https://github.com/deepgram/deepgram-python-sdk / ライセンス: MIT