Skip to content

Commit 1e86f75

Browse files
Pouyanpimiyoungc
andauthored
docs(guardrail-catalog): document running multiple self-check rails (#2176)
Signed-off-by: Miyoung Choi <miyoungc@nvidia.com> Co-authored-by: Miyoung Choi <miyoungc@nvidia.com>
1 parent 450594a commit 1e86f75

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

docs/configure-rails/guardrail-catalog/self-check.mdx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,71 @@ prompts:
255255
Answer [Yes/No]:
256256
```
257257

258+
## Running Multiple Self-Check Rails
259+
260+
By default, `self check input` and `self check output` each run a single check with a single prompt. You can run several self-check rails of the same kind, each with its own prompt and, optionally, its own model. Add a `$variant=<name>` parameter to the flow name to select a named variant. Use this to separate concerns, for example one output check for inappropriate content and another for data leakage.
261+
262+
1. Add one flow per variant to the rails section, each with a distinct `$variant=<name>`:
263+
264+
```yaml
265+
rails:
266+
output:
267+
flows:
268+
- self check output $variant=check_inappropriate
269+
- self check output $variant=check_data_leakage
270+
```
271+
272+
2. Define a prompt for each variant. The prompt `task` is the base task name followed by the same `$variant=<name>`:
273+
274+
```yaml
275+
prompts:
276+
- task: self_check_output $variant=check_inappropriate
277+
content: |-
278+
Model_output: {{ bot_response }}
279+
280+
Does this output contain inappropriate content?
281+
282+
Answer [Yes/No]:
283+
- task: self_check_output $variant=check_data_leakage
284+
content: |-
285+
Model_output: {{ bot_response }}
286+
287+
Does this output leak sensitive or internal data?
288+
289+
Answer [Yes/No]:
290+
```
291+
292+
<Note>
293+
294+
Each enabled variant requires a matching prompt. If a prompt is missing, an exception is raised when the configuration is loaded.
295+
296+
</Note>
297+
298+
3. To route a variant to its own model, define a model whose `type` matches the variant name:
299+
300+
```yaml
301+
models:
302+
- type: main
303+
engine: openai
304+
model: gpt-5.5
305+
- type: check_inappropriate
306+
engine: openai
307+
model: gpt-4.1-mini
308+
- type: check_data_leakage
309+
engine: openai
310+
model: gpt-4.1-mini
311+
```
312+
313+
If a variant has no matching model `type`, the rail uses the base self-check model type (`self_check_output`) when it is defined, and otherwise the `main` model.
314+
315+
The rails run in the order they are listed. As with a single self-check rail, the first variant that blocks stops further processing. Input variants work the same way with `self check input` and the `self_check_input` prompt task.
316+
317+
<Tip>
318+
319+
A self-check rail without a `$variant=` parameter uses the default `self_check_input` or `self_check_output` prompt. You can combine a default rail and one or more variant rails in the same configuration.
320+
321+
</Tip>
322+
258323
## The Dialog Rails Flow
259324

260325
The diagram below depicts the dialog rails flow in detail:

0 commit comments

Comments
 (0)