QVAC Logo

transcribe( )

Provides a simple interface for transcribing audio by collecting all streaming results into a single string response.

function transcribe(params): Promise<string>;

Collects all streaming results from transcribeStream() into a single string.

Parameters

NameTypeRequired?Description
params.modelIdstringThe identifier of the transcription model
params.audioChunkstring | BufferAudio input as file path (string) or audio buffer
params.promptstringOptional initial prompt to guide the transcription

Returns

Promise<string> — The complete transcribed text.

Throws

ErrorWhen
TRANSCRIPTION_FAILEDTranscription fails

Example

const text = await transcribe({
  modelId: "whisper-model",
  audioChunk: "/path/to/audio.wav",
});
console.log(text);

SUPPORTED_AUDIO_FORMATS

Use this exported constant to check which audio formats are accepted before passing a file to transcribe(). Avoids runtime errors from unsupported formats.

import { SUPPORTED_AUDIO_FORMATS } from "@qvac/sdk";

const ext = filePath.split(".").pop();
if (!SUPPORTED_AUDIO_FORMATS.includes(ext)) {
  console.error(`Unsupported format: ${ext}`);
}

On this page