Skip to navigation

nemoguardrails.library.tool_safety_check.actions

View as MarkdownOpen in Claude

Module Contents

Functions

NameDescription
tool_safety_check_tool_callChecks a tool call’s arguments against per-tool safety instructions using a specified LLM.
tool_safety_check_tool_resultChecks a tool result’s content against per-tool safety instructions using a specified LLM.

Data

_DEFAULT_TEMPERATURE

API

nemoguardrails.library.tool_safety_check.actions.tool_safety_check_tool_call(
llms: typing.Dict[str, nemoguardrails.types.LLMModel],
tool_definition: typing.Optional[nemoguardrails.guardrails.tool_schema.Tool],
model_name: typing.Optional[str] = None,
variant: typing.Optional[str] = None,
argument_name: typing.Optional[str] = None,
kwargs = {}
async

Checks a tool call’s arguments against per-tool safety instructions using a specified LLM.

Parameters:

tool_call
ToolCall

ToolCall — The tool call to check.

tool_definition
Optional[Tool]

Optional[ Tool ] — The declared tool, used only by @tool_call_validation.

model_name
Optional[str]Defaults to None

The judge model, from $model= on the flow.

variant
Optional[str]Defaults to None

Selects which config.prompts task to render, from $variant= on the flow.

argument_name
Optional[str]Defaults to None

Narrows the arguments sent to the judge to one named argument, from $argument= on the flow. Absent, the full arguments dict is sent.

nemoguardrails.library.tool_safety_check.actions.tool_safety_check_tool_result(
llms: typing.Dict[str, nemoguardrails.types.LLMModel],
model_name: typing.Optional[str] = None,
variant: typing.Optional[str] = None,
kwargs = {}
async

Checks a tool result’s content against per-tool safety instructions using a specified LLM.

Parameters:

tool_call
ToolCall

ToolCall — The prior call this result answers, used to resolve the tool name.

tool_result
ToolResult

ToolResult — The tool result to check.

model_name
Optional[str]Defaults to None

The judge model, from $model= on the flow.

variant
Optional[str]Defaults to None

Selects which config.prompts task to render, from $variant= on the flow.

nemoguardrails.library.tool_safety_check.actions._DEFAULT_TEMPERATURE = 1e-20