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
@@ -25,104 +25,132 @@ For a complete record of changes in a release, refer to the
25
25
26
26
---
27
27
28
-
(v0-20-0)=
28
+
(v0-21-0)=
29
29
30
-
## 0.20.0
30
+
## 0.21.0
31
31
32
-
(v0-20-0-features)=
32
+
(v0-21-0-features)=
33
33
34
34
### Key Features
35
35
36
-
- Added support for multilingual content safety models such as [NVIDIA Nemotron Safety Guard 8B v3](https://build.nvidia.com/nvidia/llama-3_1-nemotron-safety-guard-8b-v3). This feature uses the [fast-langdetect package](https://github.com/LlmKira/fast-langdetect) to detect the user's input language and return refusal messages in the appropriate language. To use this feature, install the NeMo Guardrails library with the `multilingual` extra.
36
+
- Added the `IORails` class, a new optimized execution engine that runs NemoGuard input and output rails, such as
37
+
content-safety, topic-safety, and jailbreak detection, in parallel. The engine is opt-in:
38
+
set `NEMO_GUARDRAILS_IORAILS_ENGINE=1` to enable it. When enabled, the configuration is
39
+
validated for compatibility and falls back to LLMRails if unsupported flows are detected.
40
+
For more information, refer to [](../configure-rails/yaml-schema/guardrails-configuration/parallel-rails.md#iorails-engine).
37
41
38
-
```bash
39
-
pip install nemoguardrails[multilingual]
40
-
```
42
+
- Added the `check_async()` and `check()` methods on `LLMRails` to enable validating messages against input and output rails without triggering full LLM generation.
43
+
Returns a `RailsResult` with `PASSED`, `MODIFIED`, or `BLOCKED` status.
44
+
For more information, refer to [](../run-rails/using-python-apis/check-messages.md).
41
45
42
-
- Added support for configuring custom refusal messages per language to complement multilingual content safety models. You can enable multilingual refusal messages and specify custom refusal messages in the `rails.config.content_safety` section of the `config.yml` file.
43
-
44
-
```yaml
45
-
rails:
46
-
config:
47
-
content_safety:
48
-
multilingual:
49
-
enabled: true
50
-
refusal_messages:
51
-
en: "Sorry, I cannot help with that request."
52
-
es: "Lo siento, no puedo ayudar con esa solicitud."
53
-
zh: "抱歉,我无法处理该请求。"
54
-
# Add other languages as needed
55
-
```
46
+
- The guardrails server now exposes a fully OpenAI-compatible
47
+
REST API. The `/v1/chat/completions` endpoint accepts standard `ChatCompletion` requests with a
48
+
`guardrails` field for config selection. A new `/v1/models` endpoint lists available models from the
49
+
configured provider. The `openai` package is now a required component of the optional `server` extra ([#1623](https://github.com/NVIDIA-NeMo/Guardrails/pull/1623)).
50
+
For more information, refer to [](../run-rails/using-fastapi-server/overview.md).
51
+
52
+
- Added the `GuardrailsMiddleware` class, a new middleware that integrates with
53
+
LangChain's Agent Middleware protocol, applying input and output rail checks before and after
54
+
every model call in the agent loop. It includes the `InputRailsMiddleware` and `OutputRailsMiddleware`
55
+
convenience subclasses.
56
+
For more information, refer to [](../integration/langchain/agent-middleware.md).
57
+
58
+
- Added three new community rails:
59
+
[PolicyAI](../configure-rails/guardrail-catalog/community/policyai.md) for policy-based content moderation,
60
+
[CrowdStrike AIDR](../configure-rails/guardrail-catalog/community/crowdstrike-aidr.md) for AI-powered detection and response, and
61
+
[Regex Detection](../configure-rails/guardrail-catalog/community/regex.md) for pattern-based content filtering on input, output, and retrieval.
62
+
63
+
- Jailbreak detection configuration is now validated at
64
+
create-time. Invalid thresholds and malformed URLs raise errors immediately.
65
+
For more information, refer to [](../configure-rails/guardrail-catalog/jailbreak-protection.md#configuration-validation).
56
66
57
-
For more information, refer to [](../configure-rails/guardrail-catalog/content-safety.md#multilingual-refusal-messages).
58
-
- Added support for [NVIDIA GLiNER-PII](https://huggingface.co/nvidia/gliner-PII) for detecting entities such as names, email addresses, phone numbers, social security numbers, and more. For more information, refer to [](../configure-rails/guardrail-catalog/community/gliner.md).
67
+
- Embedding indexes are now initialized lazily.
68
+
FastEmbed models are only downloaded when semantic search is needed, reducing startup time for
69
+
configurations that use only input and output rails.
70
+
71
+
(v0-21-0-breaking-changes)=
59
72
60
73
### Breaking Changes
61
74
62
-
- A breaking change removes redundant streaming configuration for output rails. Prior to the change, streaming had to be enabled in two places: `streaming` and `rails.output.streaming.enabled`. This change removes the top-level `streaming` configuration.
Copy file name to clipboardExpand all lines: docs/configure-rails/guardrail-catalog/jailbreak-protection.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,18 @@ rails:
48
48
If the `server_endpoint` parameter is not set, the checks will run in-process. This is useful for TESTING PURPOSES ONLY and **IS NOT RECOMMENDED FOR PRODUCTION DEPLOYMENTS**.
49
49
```
50
50
51
+
### Configuration Validation
52
+
53
+
The jailbreak detection configuration is validated at create-time. Invalid values raise errors
54
+
immediately instead of failing silently at runtime. The following validation rules apply:
55
+
56
+
| Parameter | Rule |
57
+
|-----------|------|
58
+
|`length_per_perplexity_threshold`| Must be greater than 0 |
59
+
|`prefix_suffix_perplexity_threshold`| Must be greater than 0 |
60
+
|`nim_base_url`| Must start with `http://` or `https://`|
61
+
|`server_endpoint`| Must start with `http://` or `https://`|
When using the Python API, import the `Guardrails` class directly and pass `use_iorails=True`:
41
+
42
+
```python
43
+
from nemoguardrails import RailsConfig
44
+
from nemoguardrails.guardrails.guardrails import Guardrails
45
+
46
+
config = RailsConfig.from_path("./config")
47
+
guardrails = Guardrails(config, use_iorails=True)
48
+
```
49
+
50
+
## YAML-Based Parallel Execution
51
+
52
+
You can also configure existing LLMRails flows to run in parallel using the `parallel: True`
53
+
option in the `config.yml` file. This approach works with any flow type and does not require
54
+
the IORails engine.
55
+
56
+
### When to Use
57
+
58
+
Use YAML-based parallel execution:
13
59
14
60
- For I/O-bound rails such as external API calls to LLMs or third-party integrations.
15
61
- If you have two or more independent input or output rails without shared state dependencies.
16
62
- In production environments where response latency affects user experience and business metrics.
17
63
18
-
## When Not to Use Parallel Rails Execution
64
+
###When Not to Use
19
65
20
66
Avoid parallel execution:
21
67
22
68
- For CPU-bound rails; it might not improve performance and can introduce overhead.
23
69
- During development and testing for debugging and simpler workflows.
24
70
25
-
## Configuration Example
71
+
###Configuration Example
26
72
27
-
To enable parallel execution, set `parallel: True` in the `rails.input` and `rails.output` sections in the `config.yml` file. The following configuration example is tested by NVIDIA and shows how to enable parallel execution for input and output rails.
73
+
To enable parallel execution, set `parallel: True` in the `rails.input` and `rails.output` sections in the `config.yml` file.
28
74
29
75
```{note}
30
76
Input rail mutations can lead to erroneous results during parallel execution because of race conditions arising from the execution order and timing of parallel operations. This can result in output divergence compared to sequential execution. For such cases, use sequential mode.
Copy file name to clipboardExpand all lines: docs/getting-started/installation-guide.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,7 @@ You can install the NeMo Guardrails library with optional extra packages to add
122
122
|-------|-------------|
123
123
|`nvidia`| NVIDIA-hosted model integration through [build.nvidia.com](https://build.nvidia.com/)|
124
124
|`openai`| OpenAI-hosted model integration |
125
+
|`server`|[Guardrails API server](../run-rails/using-fastapi-server/overview.md) dependencies (aiofiles for async file handling, openai for API schemas). FastAPI is a core dependency. Required to run `nemoguardrails server`. |
125
126
|`sdd`|[Sensitive data detection](../configure-rails/guardrail-catalog/pii-detection.md#presidio-based-sensitive-data-detection) using Presidio |
126
127
|`eval`|[Evaluation tools](../evaluation/evaluate-guardrails.md) for testing guardrails |
0 commit comments