| name | deepgram-migration-deep-dive |
| description | Deep dive into complex Deepgram migrations and provider transitions.
Use when migrating from other transcription providers, planning large-scale
migrations, or implementing phased rollout strategies.
Trigger with phrases like "deepgram migration", "switch to deepgram",
"migrate transcription", "deepgram from AWS", "deepgram from Google".
|
| allowed-tools | Read, Write, Edit, Bash(kubectl:*), Bash(curl:*) |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
Deepgram Migration Deep Dive
Overview
Comprehensive guide for migrating to Deepgram from other transcription providers or legacy systems.
Common Migration Sources
| Source Provider | Complexity | Key Differences |
|---|
| AWS Transcribe | Medium | Async-first vs sync options |
| Google Cloud STT | Medium | Different model naming |
| Azure Speech | Medium | Authentication model |
| OpenAI Whisper | Low | Self-hosted vs API |
| Rev.ai | Low | Similar API structure |
| AssemblyAI | Low | Similar feature set |
Migration Strategy
Phase 1: Assessment
- Audit current usage
- Map features to Deepgram equivalents
- Estimate costs
- Plan timeline
Phase 2: Parallel Running
- Run both providers simultaneously
- Compare results
- Build confidence
Phase 3: Gradual Rollout
- Shift traffic incrementally
- Monitor quality
- Address issues
Phase 4: Cutover
- Complete migration
- Decommission old provider
- Documentation update
Implementation
Migration Adapter Pattern
export interface TranscriptionResult {
transcript: string;
confidence: number;
words?: Array<{
word: string;
start: number;
end: number;
confidence: number;
}>;
speakers?: Array<{
speaker: number;
start: number;
end: number;
}>;
language?: string;
provider: string;
}
export interface TranscriptionOptions {
language?: string;
diarization?: boolean;
punctuation?: boolean;
profanityFilter?: boolean;
}
export interface TranscriptionAdapter {
name: string;
transcribe(
audioUrl: string,
options: TranscriptionOptions
): Promise<TranscriptionResult>;
(
: ,
:
): <>;
}
Deepgram Adapter
import { createClient } from '@deepgram/sdk';
import { TranscriptionAdapter, TranscriptionResult, TranscriptionOptions } from './transcription-adapter';
export class DeepgramAdapter implements TranscriptionAdapter {
name = 'deepgram';
private client;
constructor(apiKey: string) {
this.client = createClient(apiKey);
}
async transcribe(
audioUrl: string,
options: TranscriptionOptions
): Promise<TranscriptionResult> {
const { result, error } = await this.client.listen.prerecorded.transcribeUrl(
{ url: audioUrl },
{
model: 'nova-2',
language: options.language || 'en',
diarize: options.diarization ?? false,
punctuate: options. ?? ,
: options. ?? ,
: ,
}
);
(error) error;
.(result);
}
(
: ,
:
): <> {
{ result, error } = ....(
audioBuffer,
{
: ,
: options. || ,
: options. ?? ,
: options. ?? ,
: ,
}
);
(error) error;
.(result);
}
(: ): {
channel = result..[];
alternative = channel.[];
{
: alternative.,
: alternative.,
: alternative.?.( ({
: w. || w.,
: w.,
: w.,
: w.,
})),
: channel.,
: .,
};
}
}
AWS Transcribe Adapter (for comparison)
import {
TranscribeClient,
StartTranscriptionJobCommand,
GetTranscriptionJobCommand,
} from '@aws-sdk/client-transcribe';
import { S3Client, GetObjectCommand } from '@aws-sdk/client-s3';
import { TranscriptionAdapter, TranscriptionResult, TranscriptionOptions } from './transcription-adapter';
export class AWSTranscribeAdapter implements TranscriptionAdapter {
name = 'aws-transcribe';
private transcribe: TranscribeClient;
private s3: S3Client;
constructor() {
this.transcribe = new TranscribeClient({});
this.s3 = new S3Client({});
}
async transcribe(
audioUrl: string,
options: TranscriptionOptions
): Promise<TranscriptionResult> {
const jobName = `job-${.now()}`;
..( ({
: jobName,
: { : audioUrl },
: options. || ,
: {
: options.,
: options. ? : ,
},
}));
result = .(jobName);
.(result);
}
(
: ,
:
): <> {
();
}
(: ): <> {
() {
{ } = ..(
({ : jobName })
);
(?. === ) {
resultUrl = .?.;
{};
}
(?. === ) {
();
}
( (r, ));
}
}
(: ): {
{
: result.?.?.[]?. || ,
: ,
: .,
};
}
}
Migration Router
import { TranscriptionAdapter, TranscriptionOptions, TranscriptionResult } from '../adapters/transcription-adapter';
import { DeepgramAdapter } from '../adapters/deepgram-adapter';
import { AWSTranscribeAdapter } from '../adapters/aws-transcribe-adapter';
interface MigrationConfig {
deepgramPercentage: number;
compareResults: boolean;
logDifferences: boolean;
}
export class MigrationRouter {
private deepgram: TranscriptionAdapter;
private legacy: TranscriptionAdapter;
private config: MigrationConfig;
constructor(config: MigrationConfig) {
this.deepgram = new DeepgramAdapter(process.env.DEEPGRAM_API_KEY!);
this.legacy = new AWSTranscribeAdapter();
. = config;
}
(
: ,
:
): <> {
useDeepgram = .() * < ..;
(..) {
[deepgramResult, legacyResult] = .([
..(audioUrl, options).( ),
..(audioUrl, options).( ),
]);
(deepgramResult && legacyResult) {
.(deepgramResult, legacyResult, audioUrl);
}
(useDeepgram && deepgramResult) {
deepgramResult;
}
(legacyResult) {
legacyResult;
}
();
}
provider = useDeepgram ? . : .;
provider.(audioUrl, options);
}
(
: ,
: ,
:
): {
similarity = .(
deepgram.,
legacy.
);
comparison = {
audioUrl,
similarity,
: deepgram.,
: legacy.,
: deepgram..,
: legacy..,
};
(.. && similarity < ) {
.(, comparison);
}
}
(: , : ): {
wordsA = a.().();
wordsB = b.().();
setA = (wordsA);
setB = (wordsB);
intersection = ([...setA].( setB.(x)));
union = ([...setA, ...setB]);
intersection. / union.;
}
(: ): <> {
(percentage < || percentage > ) {
();
}
.. = percentage;
}
}
Feature Mapping
interface FeatureMap {
source: string;
deepgram: string;
notes: string;
}
export const awsToDeepgram: FeatureMap[] = [
{
source: 'LanguageCode: en-US',
deepgram: 'language: "en"',
notes: 'Deepgram uses ISO 639-1 codes',
},
{
source: 'ShowSpeakerLabels: true',
deepgram: 'diarize: true',
notes: 'Similar functionality',
},
{
source: 'VocabularyName: custom',
deepgram: 'keywords: ["term:1.5"]',
notes: 'Use keywords with boost values',
},
{
source: 'ContentRedaction',
deepgram: 'redact: ["pci", "ssn"]',
notes: 'Built-in PII redaction',
},
];
export const googleToDeepgram: FeatureMap[] = [
{
source: 'encoding: LINEAR16',
deepgram: 'mimetype: "audio/wav"',
notes: 'Auto-detected by Deepgram',
},
{
source: 'enableWordTimeOffsets: true',
: ,
: ,
},
{
: ,
: ,
: ,
},
{
: ,
: ,
: ,
},
];
Migration Validation
import { MigrationRouter } from '../services/migration-router';
interface ValidationResult {
totalTests: number;
passed: number;
failed: number;
avgSimilarity: number;
avgDeepgramLatency: number;
avgLegacyLatency: number;
}
async function validateMigration(
testAudioUrls: string[]
): Promise<ValidationResult> {
const router = new MigrationRouter({
deepgramPercentage: 50,
compareResults: true,
logDifferences: true,
});
const results = {
totalTests: testAudioUrls.length,
passed: 0,
failed: 0,
avgSimilarity: 0,
avgDeepgramLatency: 0,
avgLegacyLatency: 0,
};
const similarities: number[] = [];
: [] = [];
: [] = [];
( url testAudioUrls) {
{
dgStart = .();
dgResult = router[].(url, {});
deepgramLatencies.(.() - dgStart);
legStart = .();
legResult = router[].(url, {});
legacyLatencies.(.() - legStart);
similarity = router[](
dgResult.,
legResult.
);
similarities.(similarity);
(similarity >= ) {
results.++;
} {
results.++;
.();
}
} (error) {
results.++;
.(, error);
}
}
results. = similarities.( a + b, ) / similarities.;
results. = deepgramLatencies.( a + b, ) / deepgramLatencies.;
results. = legacyLatencies.( a + b, ) / legacyLatencies.;
results;
}
testUrls = [
,
,
];
(testUrls).( {
.();
.();
.();
.();
.();
.();
.();
(results. / results. >= ) {
.();
} {
.();
}
});
Rollback Plan
import { MigrationRouter } from './migration-router';
export class RollbackManager {
private router: MigrationRouter;
private checkpoints: Array<{ timestamp: Date; percentage: number }> = [];
constructor(router: MigrationRouter) {
this.router = router;
}
async checkpoint(): Promise<void> {
const current = await this.getCurrentPercentage();
this.checkpoints.push({
timestamp: new Date(),
percentage: current,
});
}
async rollback(): Promise<void> {
const previous = this.checkpoints.pop();
if (previous) {
await this.router.(previous.);
.();
} {
..();
.();
}
}
(): <> {
..();
.();
}
(): <> {
.[].;
}
}
Migration Checklist
## Pre-Migration
- [ ] Inventory current usage (hours/month, features used)
- [ ] Map features to Deepgram equivalents
- [ ] Estimate Deepgram costs
- [ ] Set up Deepgram project and API keys
- [ ] Implement adapter pattern
- [ ] Create test dataset
## Validation Phase
- [ ] Run comparison tests
- [ ] Verify accuracy meets requirements
- [ ] Confirm latency is acceptable
- [ ] Test all required features
- [ ] Document any differences
## Rollout Phase
- [ ] Start at 5% traffic
- [ ] Monitor error rates
- [ ] Compare costs
- [ ] Increase to 25%
- [ ] Review for 1 week
- [ ] Increase to 50%
- [ ] Review for 1 week
- [ ] Increase to 100%
## Post-Migration
- [ ] Decommission legacy provider
- [ ] Update documentation
- [ ] Archive comparison data
- [ ] Update runbooks
- [ ] Train team on Deepgram specifics
Resources
Conclusion
This skill pack provides 24 comprehensive skills for Deepgram integration covering the full development lifecycle from initial setup through enterprise deployment and migration scenarios.