8000 doc: improve self-check rails in guardrails library by Pouyanpi · Pull Request #1039 · NVIDIA/NeMo-Guardrails · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

doc: improve self-check rails in guardrails library #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions docs/user-guides/guardrails-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,13 @@ If a prompt is not defined, an exception will be raised when the configuration i

The above is an example prompt you can use with the *self check input rail*. See the [Example Prompts](#example-prompts) section below for more details. The `self_check_input` prompt has an input variable `{{ user_input }}` which includes the input from the user. The completion must be "yes" if the input should be blocked and "no" otherwise.

The self-check input rail executes the [`self_check_input` action](https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/nemoguardrails/library/self_check/input_check/actions.py), which returns `True` if the input should be allowed, and `False` otherwise:
The self-check input rail executes the [`self_check_input` action](https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/nemoguardrails/library/self_check/input_check/actions.py), which returns `True` if the input should be allowed, and `False` otherwise.

```colang
define flow self check input
$allowed = execute self_check_input

if not $allowed
bot refuse to respond
stop
```

When the input should not be allowed, the `bot refuse to respond` message is returned. You can override the default response by including the following in one of the Colang files:
When the input should not be allowed, the `bot refuse to respond` message is returned. You can override the default response by modifying the following `bot refuse to response` flow in one of the Colang files:

```colang
define bot refuse to respond
"I'm sorry, I can't respond to that."
"SOME MODIFIED MESSAGE"
```

#### Example prompts
Expand Down Expand Up @@ -182,22 +173,13 @@ If a prompt is not defined, an exception will be raised when the configuration i

The above is an example prompt you can use with the *self check output rail*. See the [Example Prompts](#example-prompts-1) section below for more details. The `self_check_output` prompt has an input variable `{{ bot_response }}` which includes the output from the bot. The completion must be "yes" if the output should be blocked and "no" otherwise.

The self-check output rail executes the [`self_check_output` action](https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/nemoguardrails/library/self_check/output_check/actions.py), which returns `True` if the output should be allowed, and `False` otherwise:

```colang
define flow self check output
$allowed = execute self_check_output

if not $allowed
bot refuse to respond
stop
```
The self-check output rail executes the [`self_check_output` action](https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/nemoguardrails/library/self_check/output_check/actions.py), which returns `True` if the output should be allowed, and `False` otherwise.

The `bot refuse to respond` message is returned when the output should not be allowed. You can override the default response by including the following in one of the Colang files:

```colang
define bot refuse to respond
"I'm sorry, I can't respond to that."
"SOME MODIFIED MESSAGE"
```

#### Example prompts
Expand Down
Loading
0