Skip to Content

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

ParameterType

options?

UseVoiceOptions

Returns

UseVoiceResult

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