Skip to content

Commit 0db5c01

Browse files
authored
docs(exceptions): update exception types and remove tracing (#1652)
* docs(exceptions): update exception types and remove tracing - Updated the list of exception types to reflect additional integration- specific exceptions in the guardrails library. - Removed detailed descriptions and Colang examples for each exception type, consolidating documentation. - Deleted the section on integration with tracing, including guidance and references to tracing configuration.
1 parent a0f6d04 commit 0db5c01

File tree

1 file changed

+8
-52
lines changed

1 file changed

+8
-52
lines changed

docs/configure-rails/exceptions.md

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -87,47 +87,16 @@ When the `self check input` rail is triggered, the following exception is return
8787

8888
## Exception Types
8989

90-
NeMo Guardrails supports several predefined exception types:
90+
The NeMo Guardrails library includes additional exception types for specific integrations:
9191

92-
### InputRailException
92+
- `LlamaGuardInputRailException` / `LlamaGuardOutputRailException`
93+
- `JailbreakDetectionRailException`
94+
- `ContentSafetyCheckInputException` / `ContentSafetyCheckOutputException`
95+
- `FactCheckRailException`
96+
- `SelfCheckHallucinationRailException`
97+
- `InjectionDetectionRailException`
9398

94-
Raised when input rails block or reject user input.
95-
96-
```colang
97-
define flow custom input check
98-
if $user_message contains "forbidden_word"
99-
create event InputRailException(message="Input contains forbidden content.")
100-
```
101-
102-
### OutputRailException
103-
104-
Raised when output rails block or reject bot responses.
105-
106-
```colang
107-
define flow custom output check
108-
if $bot_message contains "sensitive_info"
109-
create event OutputRailException(message="Output contains sensitive information.")
110-
```
111-
112-
### DialogRailException
113-
114-
Raised when dialog rails encounter issues during conversation flow.
115-
116-
```colang
117-
define flow topic restriction
118-
if $user_intent == "ask_about_restricted_topic"
119-
create event DialogRailException(message="This topic is not allowed in the current context.")
120-
```
121-
122-
### RetrievalRailException
123-
124-
Raised when retrieval rails encounter issues with document retrieval.
125-
126-
```colang
127-
define flow retrieval validation
128-
if len($relevant_chunks) == 0
129-
create event RetrievalRailException(message="No relevant information found for the query.")
130-
```
99+
Each library rail raises its own exception type when `enable_rails_exceptions` is enabled.
131100

132101
---
133102

@@ -218,16 +187,3 @@ except Exception as e:
218187
5. **Exception Categories**: Use appropriate exception types to categorize different kinds of errors.
219188

220189
6. **Configuration Control**: Use the `enable_rails_exceptions` setting to control whether rails return exceptions or predefined messages.
221-
222-
---
223-
224-
## Integration with Tracing
225-
226-
Exceptions are automatically captured by the tracing system when enabled. This allows you to:
227-
228-
- Monitor exception frequency and types
229-
- Track which rails are triggering exceptions
230-
- Analyze patterns in user inputs that cause exceptions
231-
- Debug and improve rail configurations
232-
233-
For more information on tracing, see the [Tracing Configuration](tracing-configuration.md) guide.

0 commit comments

Comments
 (0)