deepgram-go-text-intelligence
bởi deepgram
Sử dụng khi viết hoặc xem xét mã Go trong kho lưu trữ này để gửi văn bản đến Deepgram Read thông qua máy khách phân tích. Định tuyến đầu vào giọng nói/âm thanh đến…
npx skills add https://github.com/deepgram/deepgram-go-sdk --skill deepgram-go-text-intelligenceUsing Deepgram Text Intelligence from the Go SDK
When to use this product
Use this skill for plain-text analysis handled by pkg/client/analyze.
- summarization
- sentiment on text input
- URL, file, or stream based Read requests
Use a different skill when:
- your source material is audio and should go through
/v1/listen(deepgram-go-audio-intelligence) - you need transcription first (
deepgram-go-speech-to-text) - you need admin endpoints (
deepgram-go-management-api)
Authentication
Set DEEPGRAM_API_KEY before creating the analyze client.
export DEEPGRAM_API_KEY="your_api_key"
Quick start
package main
import (
"context"
"fmt"
"log"
"strings"
api "github.com/deepgram/deepgram-go-sdk/v3/pkg/api/analyze/v1"
analyze "github.com/deepgram/deepgram-go-sdk/v3/pkg/client/analyze"
interfaces "github.com/deepgram/deepgram-go-sdk/v3/pkg/client/interfaces"
)
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
ctx := context.Background()
client := analyze.NewWithDefaults()
dg := api.New(client)
resp, err := dg.FromStream(
ctx,
strings.NewReader("Deepgram provides APIs for speech, voice, and media intelligence."),
&interfaces.AnalyzeOptions{Summarize: true, Sentiment: true},
)
if err != nil {
return err
}
if resp.Results.Summary != nil {
fmt.Println(resp.Results.Summary.Text)
}
return nil
}
Key parameters
interfaces.AnalyzeOptions- common fields include
Summarize,Sentiment, and other Read features exposed by the analyze client
- common fields include
- request helpers
- on
pkg/api/analyze/v1:api.New(client).FromFile,FromStream,FromURL
- on
- constructors
analyze.NewWithDefaults()analyze.New(apiKey, options)
API reference (layered)
- In-repo reference
README.mddocs.gopkg/client/analyze/client.gopkg/client/analyze/v1/client.gopkg/client/interfaces/v1/types-analyze.gopkg/api/version/analyze-version.go
- OpenAPI
https://developers.deepgram.com/openapi.yaml
- AsyncAPI
https://developers.deepgram.com/asyncapi.yaml
- Context7
/llmstxt/developers_deepgram_llms_txt
- Product docs
https://developers.deepgram.com/reference/text-intelligence/analyze-texthttps://developers.deepgram.com/docs/text-intelligencehttps://developers.deepgram.com/docs/text-sentiment-analysis
Gotchas
- The Go package is named
analyze, but the product route maps to Read / text intelligence. - Do not send raw audio here; audio intelligence features live on the listen REST path.
FromFile,FromStream, andFromURLlive on thepkg/api/analyze/v1wrapper, not on the base client.- Reuse
context.Contextand stream readers for large inputs instead of materializing everything into one string.
Example files in this repo
examples/analyze/summary/main.goexamples/analyze/sentiment/main.go
Central product skills
For cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:
npx skills add deepgram/skills
This SDK ships language-idiomatic code skills; deepgram/skills ships cross-language product knowledge (see api, docs, recipes, examples, starters, setup-mcp).