@absolutejs/voice-deepgram
v0.0.20-beta.95
Published
Deepgram speech-to-text adapter for @absolutejs/voice
Readme
@absolutejs/voice-deepgram
Deepgram speech-to-text adapter for @absolutejs/voice.
Install
bun add @absolutejs/voice @absolutejs/voice-deepgramSetup
import { deepgram } from '@absolutejs/voice-deepgram';
const stt = deepgram({
apiKey: process.env.DEEPGRAM_API_KEY!,
model: 'nova-3',
language: 'en-US',
punctuate: true,
smartFormat: true
});The adapter accepts 16kHz mono pcm_s16le audio from core and forwards it to Deepgram without transcoding.
What It Maps
The adapter normalizes Deepgram events into the core STTAdapter contract.
Resultswithis_final=false->partialResultswithis_final=true->finalspeech_final=true-> normalizedendOfTurnUtteranceEnd-> normalizedendOfTurn- Flux
EndOfTurnorEagerEndOfTurn-> normalizedendOfTurn - transport errors -> normalized
error - socket close -> normalized
close
Options
Supported options include:
apiKeymodellanguagepunctuatesmartFormatinterimResultsendpointingutteranceEndMsvadEventsdiarizenumeralsprofanityFilterredactkeytermorkeytermseotThresholdeagerEotThresholdeotTimeoutMskeepAliveMsconnectTimeoutMstagextra
Diagnostics
error events now include code when available from Deepgram and include request identifiers when present.
If the websocket fails to authenticate or cannot open, the adapter throws with:
- transport details (or close reason)
- the websocket URL (query params only)
- effective timeout used for open handshake
Nova models typically use endpointing, utteranceEndMs, and vadEvents.
Flux models typically use:
eotThresholdeagerEotThresholdeotTimeoutMs
If you omit those Flux options, the adapter now applies conversation-oriented defaults:
eagerEotThreshold: 0.8eotThreshold: 0.82eotTimeoutMs: 1200
API Key
Set DEEPGRAM_API_KEY in your runtime environment, or pass the key explicitly in the adapter config.
Deepgram references used for this adapter design:
- https://developers.deepgram.com/docs/audio-keep-alive
- https://developers.deepgram.com/docs/utterance-end
- https://developers.deepgram.com/docs/endpointing
- https://developers.deepgram.com/docs/flux/configuration
- https://developers.deepgram.com/docs/listening-to-audio-streaming-over-websocket
