Documentation
¶
Overview ¶
Package deepgram wraps Deepgram's speech APIs.
Two modalities are exposed:
- /v1/listen via NewTranscriptionModel — high-throughput real-time / batch transcription on the Nova family. Provider- specific knobs (smart_format, diarize, utterances, paragraphs, redact, keywords) ride through extension-threaded params;
- /v1/speak via NewSpeechModel — synthesis on the Aura voice family.
Deepgram's live streaming (WebSocket) and analyze surfaces aren't modeled here — the WebSocket flow doesn't fit Core's request/ response shape.
Native query extensions cannot select callback delivery: an asynchronous acknowledgement cannot satisfy either model's returned-result contract. Both callback and callback_method are rejected before submission.
See https://developers.deepgram.com/docs for the full reference. Speech Call aggregates under SpeechModelConfig.MaxResponseBytes; zero uses speech.DefaultMaxAudioBytes. Transcription uses httpclient.DefaultMaxJSONResponseBytes when its response budget is omitted. Both defaults belong to Core. Stream has no aggregate audio ceiling.
Index ¶
Constants ¶
const ( SpeechRequestExtensionKey = Provider + "/speech_request" SpeechResponseExtensionKey = Provider + "/speech_response" TranscriptionRequestExtensionKey = Provider + "/transcription_request" TranscriptionResponseExtensionKey = Provider + "/transcription_response" // DefaultBaseURL is Deepgram's production REST endpoint. DefaultBaseURL = "https://api.deepgram.com/v1" )
const (
Provider = "deepgram"
)
Provider is the stable backend name for host-side attribution.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SpeechModel ¶ added in v0.41.0
type SpeechModel struct {
// contains filtered or unexported fields
}
SpeechModel wraps Deepgram's /v1/speak endpoint. Supported models include the Aura family ("aura-asteria-en", "aura-luna-en", ...) and Aura-2 ("aura-2-thalia-en"); Deepgram uses model+voice fused as one id, so speech.Options.Voice is unused and speech.Options.Model carries the full picker.
func NewSpeechModel ¶ added in v0.41.0
func NewSpeechModel(ctx context.Context, config SpeechModelConfig) (*SpeechModel, error)
type SpeechModelConfig ¶ added in v0.41.0
type SpeechModelConfig struct {
APIKey string
DefaultOptions speech.Options
BaseURL string
HTTPClient *http.Client
// Call must fit in memory; Stream retains incremental delivery. Zero uses
// speech.DefaultMaxAudioBytes, and a negative limit is invalid.
MaxResponseBytes int64
}
func (SpeechModelConfig) Validate ¶ added in v0.41.0
func (s SpeechModelConfig) Validate() error
type TranscriptionModel ¶ added in v0.41.0
type TranscriptionModel struct {
// contains filtered or unexported fields
}
TranscriptionModel wraps Deepgram's /v1/listen synchronous transcription endpoint. Supported models include "nova-3" (latest), "nova-2", "enhanced", "base". Diarization, smart_format, punctuation and provider query options use official JSON keys under TranscriptionRequestExtensionKey. Core owns model and language.
The returned transcription.Output holds the merged transcript of channel 0 / alternative 0; per-word + per-utterance breakdown is stashed on the output metadata so callers needing diarization or timestamps can dig in.
func NewTranscriptionModel ¶ added in v0.41.0
func NewTranscriptionModel(ctx context.Context, config TranscriptionModelConfig) (*TranscriptionModel, error)
func (*TranscriptionModel) Call ¶ added in v0.41.0
func (t *TranscriptionModel) Call(ctx context.Context, req *transcription.Request) (*transcription.Response, error)
type TranscriptionModelConfig ¶ added in v0.41.0
type TranscriptionModelConfig struct {
APIKey string
DefaultOptions transcription.Options
BaseURL string
HTTPClient *http.Client
MaxResponseBytes int64
}
func (TranscriptionModelConfig) Validate ¶ added in v0.41.0
func (t TranscriptionModelConfig) Validate() error