Skip to navigation

nemo_voice_agent.utils

View as Markdown

Subpackages

Submodules

Package Contents

Classes

NameDescription
ConfigManagerManages configuration for the voice agent server.
FileLoggerSimple file+stdout logger with caller location tracking.

Functions

NameDescription
setup_loggingConfigure loguru to emit to stderr and a rotating log file.
setup_rotating_logRoll an existing log file aside (or delete it), then call setup_logging.

API

class nemo_voice_agent.utils.config_manager.ConfigManager(
server_base_path: str,
server_config_path: typing.Optional[str] = None
)

Manages configuration for the voice agent server. Handles loading, merging, and providing access to all configuration parameters.

_generic_hf_llm_model_id
= 'hf_llm_generic'
model_registry
= self._load_model_registry()
model_registry_path
server_config
= self._load_server_config()
use_model_registry
nemo_voice_agent.utils.config_manager.ConfigManager._configure_diarization()

Configure diarization parameters. Currently only NeMo End-to-End Diarization is supported.

nemo_voice_agent.utils.config_manager.ConfigManager._configure_llm()

Configure LLM parameters.

nemo_voice_agent.utils.config_manager.ConfigManager._configure_stt()

Configure STT parameters.

nemo_voice_agent.utils.config_manager.ConfigManager._configure_tts()

Configure TTS parameters.

nemo_voice_agent.utils.config_manager.ConfigManager._configure_turn_taking()

Configure turn taking parameters.

nemo_voice_agent.utils.config_manager.ConfigManager._initialize_config_parameters()

Initialize all configuration parameters from the loaded config.

nemo_voice_agent.utils.config_manager.ConfigManager._load_model_registry() -> typing.Dict[str, typing.Any]

Load model registry from YAML file.

nemo_voice_agent.utils.config_manager.ConfigManager._load_server_config() -> omegaconf.OmegaConf

Load and process the main server configuration.

nemo_voice_agent.utils.config_manager.ConfigManager._resolve_backchannel_phrases(
backchannel_phrases
)

Resolve turn_taking.backchannel_phrases_path to something usable.

The setting is either an inline list of phrases, None/"" to disable backchanneling, or a path to a YAML file. Only the path form needs resolving; the others are passed through untouched.

A relative path is tried against the current working directory first, then against the server base directory, so the shipped config works whether the server is launched from the repo root or from examples/generic_voice_agent/server.

Raises:

  • FileNotFoundError: If a path was given but exists at neither location. Failing here, naming both paths tried, beats letting it reach NeMoTurnTakingService — which used to report a bad path as “Invalid backchannel phrases of type <class ‘str’>”.
nemo_voice_agent.utils.config_manager.ConfigManager.get_diar_params() -> nemo_voice_agent.pipecat.services.nemo.diar.NeMoDiarInputParams

Get diarization parameters.

nemo_voice_agent.utils.config_manager.ConfigManager.get_model_registry() -> typing.Dict[str, typing.Any]

Get the model registry configuration.

nemo_voice_agent.utils.config_manager.ConfigManager.get_server_config() -> omegaconf.OmegaConf

Get the complete server configuration.

nemo_voice_agent.utils.config_manager.ConfigManager.get_stt_params() -> nemo_voice_agent.pipecat.services.nemo.stt.NeMoSTTInputParams

Get STT parameters.

nemo_voice_agent.utils.config_manager.ConfigManager.get_vad_params() -> pipecat.audio.vad.silero.VADParams

Get VAD parameters.

class nemo_voice_agent.utils.misc.FileLogger(
log_file: typing.Optional[str] = None,
mode: str = 'w'
)

Simple file+stdout logger with caller location tracking.

nemo_voice_agent.utils.misc.FileLogger.__call__(
message: str,
include_caller: bool = True
)

Allow calling the logger instance directly like a function.

nemo_voice_agent.utils.misc.FileLogger._get_caller_location() -> str

Return file:function:line of the caller, skipping frames inside FileLogger.

nemo_voice_agent.utils.misc.FileLogger.debug(
message: str,
include_caller: bool = True
)

Log at DEBUG level.

nemo_voice_agent.utils.misc.FileLogger.error(
message: str,
include_caller: bool = True
)

Log at ERROR level.

nemo_voice_agent.utils.misc.FileLogger.info(
message: str,
include_caller: bool = True
)

Log at INFO level.

nemo_voice_agent.utils.misc.FileLogger.log(
message: str,
include_caller: bool = True
)

Write a timestamped line to the log file (if set) and stdout.

nemo_voice_agent.utils.misc.FileLogger.warning(
message: str,
include_caller: bool = True
)

Log at WARNING level.

nemo_voice_agent.utils.misc.setup_logging(
log_file: str = 'bot_server.log',
log_level: str = 'DEBUG',
rotation: str = '1 day'
)

Configure loguru to emit to stderr and a rotating log file.

nemo_voice_agent.utils.misc.setup_rotating_log(
log_file: str,
log_level: str = 'DEBUG',
create_new_log: bool = False,
overwrite_existing: bool = False,
rotation: str = '1 day'
) -> None

Roll an existing log file aside (or delete it), then call setup_logging.

If create_new_log is True and the file exists, it is either removed (overwrite_existing=True) or renamed with a timestamp suffix. Used by bot server scripts that want a fresh log on every run.