Generating
Transcription
Transcribes audio into the input language.
npm i @xsai/generate-transcription
Examples
Basic
import { generateTranscription } from '@xsai/generate-transcription'
import { openAsBlob } from 'node:fs'
const { text } = await generateTranscription({
apiKey: '',
baseURL: 'http://localhost:8000/v1/',
file: await openAsBlob('./test/fixtures/basic.wav', { type: 'audio/wav' }),
fileName: 'basic.wav',
language: 'en',
model: 'deepdml/faster-whisper-large-v3-turbo-ct2',
})
Verbose + Segments
import { generateTranscription } from '@xsai/generate-transcription'
import { openAsBlob } from 'node:fs'
const { duration, language, segments, text } = await generateTranscription({
apiKey: '',
baseURL: 'http://localhost:8000/v1/',
file: await openAsBlob('./test/fixtures/basic.wav', { type: 'audio/wav' }),
fileName: 'basic.wav',
language: 'en',
model: 'deepdml/faster-whisper-large-v3-turbo-ct2',
responseFormat: 'verbose_json',
})
Verbose + Words
import { generateTranscription } from '@xsai/generate-transcription'
import { openAsBlob } from 'node:fs'
const { duration, language, text, words } = await generateTranscription({
apiKey: '',
baseURL: 'http://localhost:8000/v1/',
file: await openAsBlob('./test/fixtures/basic.wav', { type: 'audio/wav' }),
fileName: 'basic.wav',
language: 'en',
model: 'deepdml/faster-whisper-large-v3-turbo-ct2',
responseFormat: 'verbose_json',
timestampGranularities: 'word',
})