Skip to content

Commit 6a3cfd1

Browse files
authored
Merge pull request #40 from RobGeada/FlowDocumentation
Add flow documentation generation scripts
2 parents 3204d1b + 0a3dfd1 commit 6a3cfd1

2 files changed

Lines changed: 1028 additions & 0 deletions

File tree

docs/reference/library-flows.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# NeMo Guardrails Library Flows
2+
3+
4+
This document lists all available flows in the NeMo Guardrails library.
5+
6+
## Understanding the tables
7+
### Library
8+
The `Library` column indicates which library within the NeMo Guardrails repository provides this flow.
9+
To see the source code for a flow, navigate to the specified directory inside `nemoguardrails/library`,
10+
For example, the `self_check` library is located at `nemoguardrails/library/self_check`.
11+
12+
### Requires a Configured LLM
13+
Flows marked with ✓ in this column use `llm_call()` to invoke an LLM from your `config.models`. These flows:
14+
15+
* Require an LLM to be configured in `config.yml` under the `models` section
16+
* Will make LLM API calls (e.g., to OpenAI, Azure OpenAI, or local LLM servers)
17+
* May incur costs depending on your LLM provider
18+
* Performance depends on LLM latency and quality
19+
* Examples: Self-check rails, hallucination detection, content safety via LLM
20+
21+
Flows marked with ✗ do not require an LLM configuration.
22+
23+
### Requires External Server Calls
24+
Flows marked with ✓ in this column make network calls to external services or APIs *other than the configured LLMs*. These flows:
25+
26+
* Require network connectivity to external services beyond your LLM provider
27+
* May need additional configuration (API keys, service endpoints, credentials)
28+
* Have external service dependencies that must be available
29+
* Examples: GLiNER server calls, PolicyAI API, Pangea services, AutoAlign API, CrowdStrike AIDR
30+
31+
Flows marked with ✗ do not make external server calls (though they may still use LLMs if indicated in the previous column).
32+
33+
### Self-Contained Flows
34+
Flows that are marked with ✗ in *both* columns are fully self-contained. They:
35+
36+
* Work entirely offline (no network required)
37+
* Do not require LLM configuration
38+
* Have minimal latency and no per-request costs
39+
* Examples: Regex-based checks, local pattern matching, sensitive data detection
40+
41+
### Example Configs
42+
The `Example Configs` column in the table provide locations of example configurations that use the specified flow.
43+
To view the example, navigate to the specified directory within the `example/configs` directory of the NeMo Guardrails repository.
44+
45+
46+
## Input Rails
47+
48+
These flows can be configured in `rails.input.flows` in your config.yml.
49+
50+
| Flow Name | Library (`nemoguardrails/library/...`) | Requires a Configured LLM | Requires External Server Calls | Description | Example Configs |
51+
|-----------|----------------------------------------|---------------------------|--------------------------------|-------------|-----------------|
52+
| `ai defense inspect prompt` | [`nemoguardrails/library/ai_defense`](../../nemoguardrails/library/ai_defense) ||| Check if the prompt is safe according to AI Defense. | [`examples/configs/ai_defense`](../../examples/configs/ai_defense) |
53+
| `autoalign check input` | [`nemoguardrails/library/autoalign`](../../nemoguardrails/library/autoalign) ||| | [`examples/configs/autoalign/autoalign_config`](../../examples/configs/autoalign/autoalign_config) |
54+
| `content safety check input` | [`nemoguardrails/library/content_safety`](../../nemoguardrails/library/content_safety) ||| | [`examples/configs/nemoguards`](../../examples/configs/nemoguards)<br/>[`examples/configs/content_safety`](../../examples/configs/content_safety)<br/>[`examples/configs/nemoguards_cache`](../../examples/configs/nemoguards_cache)<br/>[`examples/configs/content_safety_multilingual`](../../examples/configs/content_safety_multilingual)<br/>[`examples/configs/content_safety_local`](../../examples/configs/content_safety_local)<br/>[`examples/configs/content_safety_api_keys`](../../examples/configs/content_safety_api_keys)<br/>[`examples/configs/gs_content_safety/config`](../../examples/configs/gs_content_safety/config)<br/>[`examples/configs/content_safety_vision`](../../examples/configs/content_safety_vision)<br/>[`examples/configs/content_safety_reasoning`](../../examples/configs/content_safety_reasoning) |
55+
| `crowdstrike aidr guard input` | [`nemoguardrails/library/crowdstrike_aidr`](../../nemoguardrails/library/crowdstrike_aidr) ||| | [`examples/configs/crowdstrike_aidr`](../../examples/configs/crowdstrike_aidr) |
56+
| `gliner detect pii on input` | [`nemoguardrails/library/gliner`](../../nemoguardrails/library/gliner) ||| Check if the user input has PII using GLiNER. | [`examples/configs/gliner/pii_detection`](../../examples/configs/gliner/pii_detection) |
57+
| `gliner mask pii on input` | [`nemoguardrails/library/gliner`](../../nemoguardrails/library/gliner) ||| Mask any detected PII in the user input using GLiNER. | [`examples/configs/gliner/pii_masking`](../../examples/configs/gliner/pii_masking) |
58+
| `guardrailsai check input` | [`nemoguardrails/library/guardrails_ai`](../../nemoguardrails/library/guardrails_ai) ||| Check input text using relevant Guardrails AI validators. | [`examples/configs/guardrails_ai`](../../examples/configs/guardrails_ai)<br/>[`examples/configs/guardrails_ai`](../../examples/configs/guardrails_ai) |
59+
| `llama guard check input` | [`nemoguardrails/library/llama_guard`](../../nemoguardrails/library/llama_guard) ||| | [`examples/configs/llama_guard`](../../examples/configs/llama_guard) |
60+
| `pangea ai guard input` | [`nemoguardrails/library/pangea`](../../nemoguardrails/library/pangea) ||| | [`examples/configs/pangea`](../../examples/configs/pangea) |
61+
| `policyai moderation on input` | [`nemoguardrails/library/policyai`](../../nemoguardrails/library/policyai) ||| Guardrail based on PolicyAI assessment. | N/A |
62+
| `regex check input` | [`nemoguardrails/library/regex`](../../nemoguardrails/library/regex) ||| Check if the user input matches any forbidden regex patterns. | N/A |
63+
| `self check input` | [`nemoguardrails/library/self_check/input_check`](../../nemoguardrails/library/self_check/input_check) ||| | [`examples/configs/llm/vertexai`](../../examples/configs/llm/vertexai) |
64+
| `detect sensitive data on input` | [`nemoguardrails/library/sensitive_data_detection`](../../nemoguardrails/library/sensitive_data_detection) ||| Check if the user input has any sensitive data. | N/A |
65+
| `mask sensitive data on input` | [`nemoguardrails/library/sensitive_data_detection`](../../nemoguardrails/library/sensitive_data_detection) ||| Mask any sensitive data found in the user input. | N/A |
66+
| `topic safety check input` | [`nemoguardrails/library/topic_safety`](../../nemoguardrails/library/topic_safety) ||| | [`examples/configs/nemoguards`](../../examples/configs/nemoguards)<br/>[`examples/configs/nemoguards_cache`](../../examples/configs/nemoguards_cache)<br/>[`examples/configs/topic_safety`](../../examples/configs/topic_safety) |
67+
| `trend ai guard input` | [`nemoguardrails/library/trend_micro`](../../nemoguardrails/library/trend_micro) ||| | [`examples/configs/trend_micro`](../../examples/configs/trend_micro) |
68+
69+
## Output Rails
70+
71+
These flows can be configured in `rails.output.flows` in your config.yml.
72+
73+
| Flow Name | Library (`nemoguardrails/library/...`) | Requires a Configured LLM | Requires External Server Calls | Description | Example Configs |
74+
|-----------|----------------------------------------|---------------------------|--------------------------------|-------------|-----------------|
75+
| `ai defense inspect response` | [`nemoguardrails/library/ai_defense`](../../nemoguardrails/library/ai_defense) ||| Check if the response is safe according to AI Defense. | [`examples/configs/ai_defense`](../../examples/configs/ai_defense) |
76+
| `autoalign check output` | [`nemoguardrails/library/autoalign`](../../nemoguardrails/library/autoalign) ||| | [`examples/configs/autoalign/autoalign_config`](../../examples/configs/autoalign/autoalign_config) |
77+
| `autoalign factcheck output` | [`nemoguardrails/library/autoalign`](../../nemoguardrails/library/autoalign) ||| | [`examples/configs/autoalign/autoalign_factcheck_config`](../../examples/configs/autoalign/autoalign_factcheck_config) |
78+
| `autoalign groundedness output` | [`nemoguardrails/library/autoalign`](../../nemoguardrails/library/autoalign) ||| | [`examples/configs/autoalign/autoalign_groundness_config`](../../examples/configs/autoalign/autoalign_groundness_config) |
79+
| `content safety check output` | [`nemoguardrails/library/content_safety`](../../nemoguardrails/library/content_safety) ||| | [`examples/configs/nemoguards`](../../examples/configs/nemoguards)<br/>[`examples/configs/content_safety`](../../examples/configs/content_safety)<br/>[`examples/configs/nemoguards_cache`](../../examples/configs/nemoguards_cache)<br/>[`examples/configs/content_safety_multilingual`](../../examples/configs/content_safety_multilingual)<br/>[`examples/configs/content_safety_local`](../../examples/configs/content_safety_local)<br/>[`examples/configs/content_safety_api_keys`](../../examples/configs/content_safety_api_keys)<br/>[`examples/configs/gs_content_safety/config`](../../examples/configs/gs_content_safety/config)<br/>[`examples/configs/content_safety_reasoning`](../../examples/configs/content_safety_reasoning) |
80+
| `crowdstrike aidr guard output` | [`nemoguardrails/library/crowdstrike_aidr`](../../nemoguardrails/library/crowdstrike_aidr) ||| | [`examples/configs/crowdstrike_aidr`](../../examples/configs/crowdstrike_aidr) |
81+
| `alignscore check facts` | [`nemoguardrails/library/factchecking/align_score`](../../nemoguardrails/library/factchecking/align_score) ||| | [`examples/configs/rag/fact_checking`](../../examples/configs/rag/fact_checking) |
82+
| `gliner detect pii on output` | [`nemoguardrails/library/gliner`](../../nemoguardrails/library/gliner) ||| Check if the bot output has PII using GLiNER. | [`examples/configs/gliner/pii_detection`](../../examples/configs/gliner/pii_detection) |
83+
| `gliner mask pii on output` | [`nemoguardrails/library/gliner`](../../nemoguardrails/library/gliner) ||| Mask any detected PII in the bot output using GLiNER. | [`examples/configs/gliner/pii_masking`](../../examples/configs/gliner/pii_masking) |
84+
| `guardrailsai check output` | [`nemoguardrails/library/guardrails_ai`](../../nemoguardrails/library/guardrails_ai) ||| Check output text using relevant Guardrails AI validators. | [`examples/configs/guardrails_ai`](../../examples/configs/guardrails_ai) |
85+
| `hallucination warning` | [`nemoguardrails/library/hallucination`](../../nemoguardrails/library/hallucination) ||| Warning rail for hallucination. | N/A |
86+
| `self check hallucination` | [`nemoguardrails/library/hallucination`](../../nemoguardrails/library/hallucination) ||| Output rail for checking hallucinations. | [`examples/configs/rag/custom_rag_output_rails`](../../examples/configs/rag/custom_rag_output_rails) |
87+
| `injection detection` | [`nemoguardrails/library/injection_detection`](../../nemoguardrails/library/injection_detection) ||| | N/A |
88+
| `llama guard check output` | [`nemoguardrails/library/llama_guard`](../../nemoguardrails/library/llama_guard) ||| | [`examples/configs/llama_guard`](../../examples/configs/llama_guard) |
89+
| `pangea ai guard output` | [`nemoguardrails/library/pangea`](../../nemoguardrails/library/pangea) ||| | [`examples/configs/pangea`](../../examples/configs/pangea) |
90+
| `policyai moderation on output` | [`nemoguardrails/library/policyai`](../../nemoguardrails/library/policyai) ||| Guardrail based on PolicyAI assessment. | N/A |
91+
| `regex check output` | [`nemoguardrails/library/regex`](../../nemoguardrails/library/regex) ||| Check if the bot output matches any forbidden regex patterns. | N/A |
92+
| `self check facts` | [`nemoguardrails/library/self_check/facts`](../../nemoguardrails/library/self_check/facts) ||| | [`examples/configs/rag/custom_rag_output_rails`](../../examples/configs/rag/custom_rag_output_rails)<br/>[`examples/configs/llm/hf_pipeline_llama2`](../../examples/configs/llm/hf_pipeline_llama2) |
93+
| `self check output` | [`nemoguardrails/library/self_check/output_check`](../../nemoguardrails/library/self_check/output_check) ||| | [`examples/configs/self_check_thinking`](../../examples/configs/self_check_thinking)<br/>[`examples/configs/llm/vertexai`](../../examples/configs/llm/vertexai) |
94+
| `detect sensitive data on output` | [`nemoguardrails/library/sensitive_data_detection`](../../nemoguardrails/library/sensitive_data_detection) ||| Check if the bot output has any sensitive data. | N/A |
95+
| `mask sensitive data on output` | [`nemoguardrails/library/sensitive_data_detection`](../../nemoguardrails/library/sensitive_data_detection) ||| Mask any sensitive data found in the bot output. | N/A |
96+
| `trend ai guard output` | [`nemoguardrails/library/trend_micro`](../../nemoguardrails/library/trend_micro) ||| | [`examples/configs/trend_micro`](../../examples/configs/trend_micro) |
97+
98+
## Retrieval Rails
99+
100+
These flows can be configured in `rails.retrieval.flows` in your config.yml.
101+
102+
| Flow Name | Library (`nemoguardrails/library/...`) | Requires a Configured LLM | Requires External Server Calls | Description | Example Configs |
103+
|-----------|----------------------------------------|---------------------------|--------------------------------|-------------|-----------------|
104+
| `gliner detect pii on retrieval` | [`nemoguardrails/library/gliner`](../../nemoguardrails/library/gliner) ||| Check if the relevant chunks from the knowledge base have any PII using GLiNER. | N/A |
105+
| `gliner mask pii on retrieval` | [`nemoguardrails/library/gliner`](../../nemoguardrails/library/gliner) ||| Mask any detected PII in the relevant chunks from the knowledge base using GLiNER. | N/A |
106+
| `regex check retrieval` | [`nemoguardrails/library/regex`](../../nemoguardrails/library/regex) ||| | N/A |
107+
| `detect sensitive data on retrieval` | [`nemoguardrails/library/sensitive_data_detection`](../../nemoguardrails/library/sensitive_data_detection) ||| Check if the relevant chunks from the knowledge base have any sensitive data. | N/A |
108+
| `mask sensitive data on retrieval` | [`nemoguardrails/library/sensitive_data_detection`](../../nemoguardrails/library/sensitive_data_detection) ||| Mask any sensitive data found in the relevant chunks from the knowledge base. | N/A |
109+
110+
## Statistics
111+
112+
* Total flows: 43
113+
* Self-contained (no external deps or LLM): 17
114+
* Requires external dependencies: 16
115+
* Uses LLM from `config.models`: 10
116+
* Input rails: 16
117+
* Output rails: 22
118+
* Retrieval rails: 5
119+
* Dialog rails: 0

0 commit comments

Comments
 (0)