Skip to content

Commit d6a2949

Browse files
committed
feat: Add Colang v2 example for sensitive_data_detection
1 parent 6de824e commit d6a2949

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
colang_version: "2.x"
2+
3+
models:
4+
- type: main
5+
engine: openai
6+
model: gpt-4o-mini
7+
8+
rails:
9+
config:
10+
sensitive_data_detection:
11+
input:
12+
score_threshold: 0.4
13+
entities:
14+
- PERSON
15+
- EMAIL_ADDRESS
16+
- PHONE_NUMBER
17+
- CREDIT_CARD
18+
- US_SSN
19+
- LOCATION
20+
21+
output:
22+
score_threshold: 0.4
23+
entities:
24+
- PERSON
25+
- EMAIL_ADDRESS
26+
- PHONE_NUMBER
27+
- CREDIT_CARD
28+
- US_SSN
29+
- LOCATION
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import guardrails
2+
import nemoguardrails.library.sensitive_data_detection
3+
4+
flow input rails $input_text
5+
"""Check user utterances before they get further processed."""
6+
await mask sensitive data on input
7+
8+
flow output rails $output_text
9+
"""Check response before sending it to user."""
10+
await mask sensitive data on output
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import core
2+
import llm
3+
4+
flow main
5+
activate llm continuation

0 commit comments

Comments
 (0)