Documentation
¶
Overview ¶
Package deepgram provides Deepgram's streaming speech-to-text service (over the live transcription WebSocket) and its Aura text-to-speech service.
The STT service pushes InterimTranscriptionFrames and finalized TranscriptionFrames downstream; a finalized transcript with Deepgram's speech_final marks the end of the user's turn.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSTT ¶
func NewSTT(cfg Config) *stt.StreamService
NewSTT builds a Deepgram streaming STT service.
Types ¶
type Config ¶
type Config struct {
// APIKey is the Deepgram API key. Required.
APIKey string `validate:"required"`
// ListenURL overrides the live-transcription WebSocket endpoint; empty uses
// Deepgram's hosted endpoint.
ListenURL string
// Model is the Deepgram model; empty uses "nova-3".
Model string
// Language is the transcription language; empty uses English (US).
Language language.Language
// SampleRate is the input audio sample rate; 0 uses the transport's rate.
SampleRate int
// Encoding is the audio encoding; empty uses "linear16".
Encoding string
// Channels is the channel count; 0 uses 1.
Channels int
// InterimResults emits partial transcripts; nil defaults to true.
InterimResults *bool
// SmartFormat applies Deepgram smart formatting; nil defaults to true
// (Deepgram's own default is false).
SmartFormat *bool
// Punctuate adds punctuation; nil defaults to true.
Punctuate *bool
// VADEvents requests speech-start/utterance events; nil defaults to true.
VADEvents *bool
// Endpointing is the silence in ms before a result is finalized; nil
// defaults to 300 (Deepgram's own default is 10).
Endpointing *int
// UtteranceEndMs is the silence in ms before an utterance-end event; nil
// defaults to 1000 (Deepgram leaves it unset).
UtteranceEndMs *int
// Numerals converts spoken numbers to numerals.
Numerals *bool
// ProfanityFilter filters profanity from transcripts.
ProfanityFilter *bool
// Diarize labels speakers in the transcript.
Diarize *bool
// DetectEntities enables named-entity detection.
DetectEntities *bool
// Dictation converts spoken commands (e.g. "comma") to punctuation.
Dictation *bool
// Multichannel transcribes each channel independently.
Multichannel *bool
// MipOptOut opts out of Deepgram's model-improvement program.
MipOptOut *bool
// Version pins the model version (e.g. "latest").
Version string
// Keywords boosts recognition of the given terms (legacy models); each entry
// may carry an intensifier, e.g. "snuffleupagus:5".
Keywords []string
// Keyterm boosts recognition of the given terms (nova-3).
Keyterm []string
// Redact removes the given categories of sensitive data.
Redact []string
// Replace applies find/replace rules to the transcript.
Replace []string
// Search flags occurrences of the given terms.
Search []string
// Tag attaches billing tags to the request.
Tag []string
// ExtraQuery sets arbitrary additional Deepgram query parameters not modeled
// above; values override any param of the same name set from other fields.
ExtraQuery map[string]string
}
Config configures the STT service. Fields left at their zero value fall back to jargo's defaults (which preserve its tuned turn detection); several of those defaults differ from Deepgram's own and are noted per field. Optional fields modeled as pointers or slices are omitted from the request when unset.
type TTSConfig ¶
type TTSConfig struct {
// APIKey is the Deepgram API key. Required.
APIKey string `validate:"required"`
// Model is the Aura voice model; empty uses a default.
Model string
// SampleRate is the PCM rate requested from Aura and emitted downstream;
// 0 uses 24 kHz.
SampleRate int
// Encoding is the audio encoding; empty uses "linear16".
Encoding string
}
TTSConfig configures the Aura TTS service.