You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configure-rails/guardrail-catalog/self-check.mdx
+65Lines changed: 65 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -255,6 +255,71 @@ prompts:
255
255
Answer [Yes/No]:
256
256
```
257
257
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>`:
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
+
258
323
## The Dialog Rails Flow
259
324
260
325
The diagram below depicts the dialog rails flow in detail:
0 commit comments