Safety Check Utils
Shared helper for NeMo Guardrails safety check actions.
execute_nemo_safety_check(llm_task_manager, llm, task, prompt_context, log_label)
async
Render a NeMo safety prompt, call the LLM, and parse the result.
Encapsulates the full render → call → parse pipeline shared by both
input and output safety check actions. Returns [True] (fail open)
on any exception so the Colang flow can always read $response[0]
without crashing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
llm_task_manager
|
LLMTaskManager
|
The LLM task manager. |
required |
llm
|
Any | None
|
NeMo 0.22+ LLMModel instance used for the check. The type is
|
required |
task
|
Task
|
The NeMo task type (e.g. SELF_CHECK_INPUT). |
required |
prompt_context
|
dict[str, Any]
|
Template variables passed to render_task_prompt. |
required |
log_label
|
str
|
Label used in log messages (e.g. "Input" or "Output"). |
required |
Returns:
| Type | Description |
|---|---|
list[bool | str]
|
list[bool | str]: |