Now that we can transcribe a file, we're going to steer the decoder with a prompt.
Whisper takes a short prompt string before it commits to a transcription. The prompt isn't a system instruction. It's a list of words and phrases the decoder should prefer. Names, jargon, and formatting you put in the prompt appear correctly in the output, even when the audio mumbles them.
Whisper's decoder bias comes from the prompt option. You would call it like so:
const text = await transcribe({
modelId,
audioChunk: "./examples/qvac/transcription/input/sample-16khz.wav",
prompt: "This is a test recording with clear speech and proper punctuation.",
});
console.log("▸ Transcription result:");
console.log(text);prompt is a string. Whisper tokenizes it and conditions the first few decoder steps on it. Any word in the prompt gets a head start. Any word that conflicts with the audio gets overridden.
Note: the prompt doesn't change the model's language. Set
modelConfig.language: "en"(or whatever target language you need) at load time. The prompt only steers vocabulary.
transcribe({ modelId, audioChunk: <path>, prompt: "..." }), await the result, and log "▸ Transcription result:" followed by the text.$ Run your code to see results
$