useVoice
useVoice(
options?:UseVoiceOptions):UseVoiceResult
Defined in: src/react/useVoice.ts:200Â
React hook for recording voice and transcribing it on-device using Whisper.
Transcription runs entirely in the browser via @huggingface/transformers
(ONNX Runtime + WebAssembly). The Whisper model (~40 MB for tiny) is
downloaded on first use and cached by the browser.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Example
const { startRecording, stopRecording, transcribe } = useVoice();
const handleStop = async () => {
const recording = await stopRecording();
const { text } = await transcribe(recording);
// Send text to LLM via useChat
};Last updated on