Overview
RAG systems often process sensitive documents (HR records, customer data, legal contracts). This example demonstrates:- Auto-redacting PII from user queries
- Sanitizing retrieved documents before LLM context
- Maintaining answer quality while protecting data
Architecture
Implementation
Setup
Basic RAG with Protection
With LangChain
PII Types Detected
| Type | Example | Redacted As |
|---|---|---|
| Names | John Smith | [PERSON] |
| john@company.com | [EMAIL] | |
| Phone | (555) 123-4567 | [PHONE] |
| SSN | 123-45-6789 | [SSN] |
| Credit Card | 4532-1234-5678-9012 | [CREDIT_CARD] |
Next Steps
Data Privacy Example
More data protection patterns
Threat Detection
Understand detection capabilities