Skip to navigation

nemoguardrails.actions.llm_judge

View as MarkdownOpen in Claude

Shared helpers for library rail actions that use an LLM as a judge.

Not Colang-specific, unlike nemoguardrails.actions.llm.

Module Contents

Functions

NameDescription
require_llmResolve model_name in llms, raising a clear error if it’s missing or unknown.
run_llm_judged_checkCall the judge llm with the already-rendered prompt and parse the response.

Data

DEFAULT_MAX_TOKENS

API

nemoguardrails.actions.llm_judge.require_llm(
llms: typing.Dict[str, nemoguardrails.types.LLMModel],
model_name: typing.Optional[str],
rail_name: str

Resolve model_name in llms, raising a clear error if it’s missing or unknown.

nemoguardrails.actions.llm_judge.run_llm_judged_check(
task: str,
prompt: str,
temperature: float
async

Call the judge llm with the already-rendered prompt and parse the response.

Uses the prompt’s own output_parser, which compile-time validation guarantees is declared and registered (see compiled_rail.py’s _reject_invalid_tool_safety_check_prompt).

nemoguardrails.actions.llm_judge.DEFAULT_MAX_TOKENS = 1024