nemo_voice_agent.pipecat.services.nemo.stt

View as Markdown

Module Contents

Classes

NameDescription
NeMoSTTInputParamsInput parameters for NeMo STT service.
NemoSTTServiceNeMo Speech-to-Text service for Pipecat integration.

Functions

NameDescription
get_stt_service_from_configGet the STT service from the config.

Data

ASR_EOU_MODELS

level

API

class nemo_voice_agent.pipecat.services.nemo.stt.NeMoSTTInputParams()

Bases: BaseModel

Input parameters for NeMo STT service.

att_context_size
Optional[List] = [70, 1]
buffer_size
int = 5
config_path
Optional[str] = None
frame_len_in_secs
Optional[float] = 0.08
language
Optional[Language] = Language.EN_US
raw_audio_frame_len_in_secs
Optional[float] = 0.016
class nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService(
model: typing.Optional[str] = 'nnvidia/parakeet_realtime_...,
device: typing.Optional[str] = 'cuda:0',
sample_rate: typing.Optional[int] = 16000,
params: typing.Optional[nemo_voice_agent.pipecat.services.nemo.stt.NeMoSTTInputParams] = None,
has_turn_taking: typing.Optional[bool] = None,
backend: typing.Optional[str] = 'legacy',
decoder_type: typing.Optional[str] = 'rnnt',
audio_logger: typing.Optional[nemo_voice_agent.pipecat.services.nemo.audio_logger.AudioLogger] = None,
ignore_eou_eob: typing.Optional[bool] = False,
ttfs_p99_latency: typing.Optional[float] = None,
kwargs = {}
)

Bases: STTService

NeMo Speech-to-Text service for Pipecat integration.

_audio_buffer
= bytearray()
_audio_timestamps
= []
_bytes_per_buffer
_has_turn_taking
= has_turn_taking and not self._ignore_eou_eob
_queue
= asyncio.Queue()
nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService._load_model()
nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService._reset_stt_state()

Reset the state of the STT service.

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.can_generate_metrics() -> bool

Only report initial metrics, no need to spam metrics every 80ms

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.cancel(
frame: pipecat.frames.frames.CancelFrame
)
async

Handle service cancellation.

Parameters:

frame
CancelFrame

CancelFrame that triggered this method

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.process_audio_frame(
frame: pipecat.frames.frames.AudioRawFrame,
direction: pipecat.processors.frame_processor.FrameDirection
)
async

Process an audio frame for speech recognition.

If the service is muted, this method does nothing. Otherwise, it processes the audio frame and runs speech-to-text on it, yielding transcription results. If the frame has a user_id, it is stored for later use in transcription.

Parameters:

frame
AudioRawFrame

The audio frame to process.

direction
FrameDirection

The direction of frame processing.

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.process_frame(
frame: pipecat.frames.frames.Frame,
direction: pipecat.processors.frame_processor.FrameDirection
)
async

Process incoming frames and handle VAD events.

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.reset()

Reset the state of the STT service.

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.run_stt(
audio: bytes,
audio_frame: typing.Optional[pipecat.frames.frames.AudioRawFrame] = None
) -> typing.AsyncGenerator[pipecat.frames.frames.Frame, None]
async

Process audio data and generate transcription frames.

Parameters:

audio
bytes

Raw audio bytes to transcribe

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.set_language(
language: pipecat.transcriptions.language.Language
)
async

Update the service’s recognition language.

Parameters:

language
Language

New language for recognition

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.set_model(
model: str
)
async

Update the service’s model.

Parameters:

model
str

New model name/path to use

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.start(
frame: pipecat.frames.frames.StartFrame
)
async

Handle service start.

Parameters:

frame
StartFrame

StartFrame containing initial configuration

nemo_voice_agent.pipecat.services.nemo.stt.NemoSTTService.stop(
frame: pipecat.frames.frames.EndFrame
)
async

Handle service stop.

Parameters:

frame
EndFrame

EndFrame that triggered this method

nemo_voice_agent.pipecat.services.nemo.stt.get_stt_service_from_config(
config: omegaconf.DictConfig,
audio_logger: typing.Optional[nemo_voice_agent.pipecat.services.nemo.audio_logger.AudioLogger] = None
) -> pipecat.services.stt_service.STTService

Get the STT service from the config.

nemo_voice_agent.pipecat.services.nemo.stt.ASR_EOU_MODELS = ['nvidia/parakeet_realtime_eou_120m-v1']
nemo_voice_agent.pipecat.services.nemo.stt.level = logging.getEffectiveLevel()