nemoguardrails.library.self_check.output_check.actions

View as Markdown

Module Contents

Functions

NameDescription
_self_check_outcome-
self_check_outputChecks if the output from the bot.

Data

DEFAULT_TASK

log

API

nemoguardrails.library.self_check.output_check.actions._self_check_outcome(
allowed: bool
) -> nemoguardrails.actions.rail_outcome.RailOutcome
nemoguardrails.library.self_check.output_check.actions.self_check_output(
llms: typing.Dict[str, nemoguardrails.types.LLMModel],
llm_task_manager: nemoguardrails.llm.taskmanager.LLMTaskManager,
context: typing.Optional[dict] = None,
events: typing.Optional[typing.List[dict]] = None,
llm: typing.Optional[nemoguardrails.types.LLMModel] = None,
config: typing.Optional[nemoguardrails.RailsConfig] = None,
variant: typing.Optional[str] = None,
user_message: typing.Optional[str] = None,
bot_message: typing.Optional[str] = None,
bot_thinking: typing.Optional[str] = None,
kwargs = {}
) -> nemoguardrails.actions.rail_outcome.RailOutcome
async

Checks if the output from the bot.

Prompt the LLM, using the self_check_output task prompt, to determine if the output from the bot should be allowed or not.

The LLM call should return “yes” if the output is bad and should be blocked (this is consistent with self_check_input_prompt).

Returns: RailOutcome

RailOutcome.allow() if the output should be allowed, RailOutcome.block() otherwise.

nemoguardrails.library.self_check.output_check.actions.DEFAULT_TASK = SELF_CHECK_OUTPUT_DEFAULT_TASK
nemoguardrails.library.self_check.output_check.actions.log = logging.getLogger(__name__)