Skip to main content

Usage guide

Setup, environment variables, and Python/JavaScript/Go usage examples.

NvidiaSTT

Streaming speech recognition via NVIDIA Riva / NIM. GPU-accelerated ASR over gRPC using Parakeet/Conformer models, with optional Sortformer speaker diarization and automatic punctuation.

Constructor

api_key
str | None
NVIDIA API key. Falls back to NVIDIA_API_KEY.
model
str
Riva/NIM ASR model. Default "parakeet-1.1b-en-US-asr-streaming- silero-vad-sortformer" (Parakeet 1.1B with Silero VAD + Sortformer diarization).
server
str
default:"grpc.nvcf.nvidia.com:443"
Riva gRPC endpoint. Default "grpc.nvcf.nvidia.com:443".
function_id
str
default:""
NVCF function id for the hosted model. Default "".
language_code
str
default:"en-US"
BCP-47 language tag. Default "en-US".
sample_rate
int
default:"16000"
Input rate in Hz. Default 16000.
use_ssl
bool
default:"True"
Use a TLS/SSL gRPC channel. Default True.
profanity_filter
bool
default:"False"
Mask profanity. Default False.
automatic_punctuation
bool
default:"True"
Add punctuation to the transcript. Default True.

aclose

Release any resources held by the provider.

emit

Emit an event, invoking all registered handlers with the given arguments. Handlers are called in registration order. Coroutine handlers are scheduled on the running event loop. If the emitter is closed, the call is a no-op.
event
T
required
The event to emit.

off

Remove a previously registered handler for an event. If the handler is not registered for the event, the call is a no-op.
event
T
required
The event the handler was registered for.
callback
Callable[..., Any]
required
The handler to remove.

on

Register a handler for an event. Can be used directly by passing a callback, or as a decorator when callback is omitted.
event
T
required
The event to listen for.
callback
Callable[..., Any] | None
The handler to invoke when the event is emitted. If None, a decorator is returned that registers the decorated function.
returns
Callable[..., Any]
The registered callback when callback is provided, otherwise a decorator that registers and returns the function it wraps.

on_stt_transcript

Register the coroutine invoked when a transcription event is produced.
callback
Callable[[STTResponse], Awaitable[None]]
required
An async callable that receives each STTResponse.

process_audio

Process a chunk of audio for transcription. Implementations should consume the audio frames and emit transcription results through the registered transcript callback.
audio_frames
bytes
required
Raw audio bytes to transcribe.
language
Optional[str]
Optional language code to guide recognition.

stream_transcribe

Transcribe a continuous audio stream.
audio_stream
AsyncIterator[bytes]
required
An async iterator yielding raw audio byte chunks.
returns
AsyncIterator[STTResponse]
STTResponse: Transcription events produced as audio is consumed.