Configure Deepgram local development workflow with testing and mocks.
Use when setting up development environment, configuring test fixtures,
or establishing rapid iteration patterns for Deepgram integration.
Trigger: "deepgram local dev", "deepgram development setup",
"deepgram test environment", "deepgram dev workflow", "deepgram mock".
Instrucciones de origen · Vista previa de solo lectura
name
deepgram-local-dev-loop
description
Configure Deepgram local development workflow with testing and mocks.
Use when setting up development environment, configuring test fixtures,
or establishing rapid iteration patterns for Deepgram integration.
Trigger: "deepgram local dev", "deepgram development setup",
"deepgram test environment", "deepgram dev workflow", "deepgram mock".
Set up a fast local development workflow for Deepgram: test fixtures with sample audio, mock responses for offline unit tests, Vitest integration tests against the real API, and a watch-mode transcription dev server.
# .env.development
DEEPGRAM_API_KEY=your-dev-key
DEEPGRAM_MODEL=nova-3
# .env.test (use a separate test key with low limits)
DEEPGRAM_API_KEY=your-test-key
DEEPGRAM_MODEL=base
{"scripts":{"dev":"tsx watch src/transcribe.ts","test":"vitest","test:watch":"vitest --watch","test:integration":"vitest run tests/integration/"}}
Step 4: Mock Deepgram Responses
// tests/mocks/deepgram-responses.tsexportconst mockPrerecordedResult = {
metadata: {
request_id: 'mock-request-id-001',
created: '2026-01-01T00:00:00.000Z',
duration: 12.5,
channels: 1,
models: ['nova-3'],
model_info: { 'nova-3': { name: 'nova-3', version: '2026-01-01' } },
},
results: {
channels: [{
alternatives: [{
transcript: 'Life moves pretty fast. If you don\'t stop and look around once in a while, you could miss it.',
confidence: 0.98,
words: [
{ word: 'life', start: 0.08, end: 0.32, confidence: 0.99, punctuated_word: 'Life' },
{ word: 'moves', start: 0.32, end: 0.56, confidence: 0.98, punctuated_word: 'moves' },
{ word: 'pretty', start: 0.56, end: 0.88, confidence: 0.97, punctuated_word: 'pretty' },
{ word: 'fast', start: 0.88, end: 1.12, confidence: 0.99, punctuated_word: 'fast.' },
],
}],
}],
utterances: [{
speaker: 0,
transcript: 'Life moves pretty fast. If you don\'t stop and look around once in a while, you could miss it.',
start: 0.08,
end: 5.44,
confidence: 0.98,
}],
},
};
exportconst mockLiveTranscript = {
type: 'Results',
channel_index: [0, 1],
duration: 1.5,
start: 0.0,
is_final: true,
speech_final: true,
channel: {
alternatives: [{
transcript: 'Hello, how are you today?',
confidence: 0.95,
words: [
{ word: 'hello', start: 0.0, end: 0.3, confidence: 0.98, punctuated_word: 'Hello,' },
{ word: 'how', start: 0.35, end: 0.5, confidence: 0.96, punctuated_word: 'how' },
],
}],
},
};
exportconst mockTtsResponse = {
content_type: 'audio/wav',
request_id: 'mock-tts-001',
model_name: 'aura-2-thalia-en',
characters: { count: 42, limit: 100000 },
};