Skip to navigation

Module Contents

Classes

NameDescription
FileLoggerSimple file+stdout logger with caller location tracking.

Functions

NameDescription
cli_api_keysReturn the values passed to --api-key in a CLI flag string such as vllm_server_params.
redact_cli_secretsReturn command with every --api-key value replaced by REDACTED.
redact_literalsReturn text with every occurrence of each non-empty secret replaced by REDACTED.
redact_secretsReturn a copy of config with credential values redacted; interpolations are left unresolved.
redact_valueReturn REDACTED if key is a credential key and value is set, else value with secrets redacted.
resolve_promptReturn value, or the contents of the file it names.
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.

Data

REDACTED

_CLI_API_KEY_PATTERN

API

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.cli_api_keys(
command: str
) -> list[str]

Return the values passed to --api-key in a CLI flag string such as vllm_server_params.

nemo_voice_agent.utils.misc.redact_cli_secrets(
command: str
) -> str

Return command with every --api-key value replaced by REDACTED.

nemo_voice_agent.utils.misc.redact_literals(
text: str,
secrets: typing.Iterable[typing.Optional[str]]
) -> str

Return text with every occurrence of each non-empty secret replaced by REDACTED.

nemo_voice_agent.utils.misc.redact_secrets(
config: typing.Any
) -> typing.Any

Return a copy of config with credential values redacted; interpolations are left unresolved.

Values under api_key / *_api_key keys are masked, and so are --api-key values inside strings such as vllm_server_params.

nemo_voice_agent.utils.misc.redact_value(
key: typing.Any,
value: typing.Any
) -> typing.Any

Return REDACTED if key is a credential key and value is set, else value with secrets redacted.

nemo_voice_agent.utils.misc.resolve_prompt(
value: typing.Optional[str]
) -> typing.Optional[str]

Return value, or the contents of the file it names.

Mirrors the llm.system_prompt convention already used by ConfigManager (see its SYSTEM_PROMPT handling): a value naming an existing file is read from disk, anything else is taken literally. Keeping both on the same rule means a prompt can be moved between llm and stt config without changing form.

Taking a literal prompt is unambiguous in practice — os.path.isfile is false for multi-line text, for any path that does not exist, and (because it swallows OSError/ValueError) for strings too long or malformed to be a path at all.

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.

nemo_voice_agent.utils.misc.REDACTED = '<redacted>'
nemo_voice_agent.utils.misc._CLI_API_KEY_PATTERN = re.compile('(--api[-_]key(?:=|\\s+))(\\S+)')