AI Chat with OpenAI
Protect user data when building AI chatbots with OpenAI.- Python
- JavaScript
- Java
- Personal names (
John Doe→<PERSON_1>) - Email addresses (
john@example.com→<EMAIL_ADDRESS_1>) - Any other PII in user messages
- User data never reaches OpenAI in plain text
- Compliant with privacy regulations
- Transparent to end users
AI Chat with Anthropic Claude
Protect user data when building AI chatbots with Anthropic Claude.- Python
- JavaScript
- Java
- User data never reaches Anthropic in plain text
- Works with Claude Sonnet, Opus, and Haiku
- Same tokenize/detokenize pattern as other providers
Customer Support Ticket Anonymization
Anonymize customer support tickets before storing in databases or sending to third-party analytics.- Python
- JavaScript
- Java
- Support ticket systems
- Customer feedback collection
- Quality assurance reviews
- Third-party analytics
Displaying Masked Credit Cards
Show partial credit card numbers in user interfaces while protecting full details.- Python
- JavaScript
- Java
- Users can identify their cards
- Full numbers stay protected
- Compliant with PCI-DSS
Analytics with Hashed Identifiers
Create consistent identifiers for analytics without storing actual PII.- Python
- JavaScript
- Java
- Consistent user tracking
- No PII in analytics database
- GDPR-friendly approach
Generating Test Data
Create realistic test data with synthetic PII for development and testing.- Python
- JavaScript
- Development environments
- Automated testing
- Demo environments
- Training datasets
Encrypting Sensitive Configuration
Encrypt sensitive configuration values before storing in databases.- Python
- JavaScript
- Protect secrets at rest
- Reversible encryption
- Centralized key management
Multi-Language Support & Custom Entities
Blindfold automatically detects PII across 6+ languages and supports custom entity types for industry-specific data.Automatic Multilingual Detection
- Python
- JavaScript
- 🇺🇸 English, 🇩🇪 German, 🇫🇷 French, 🇪🇸 Spanish, 🇮🇹 Italian, 🇵🇹 Portuguese, 🇳🇱 Dutch, 🇵🇱 Polish, 🇷🇺 Russian
- 🇨🇿 Czech, 🇸🇰 Slovak, 🇩🇰 Danish, 🇸🇪 Swedish, 🇳🇴 Norwegian, 🇷🇴 Romanian
- Automatic detection - no language parameter needed
- Mix multiple languages in the same request
- Works on 15+ languages without configuration
Custom Entity Detection
Define custom entities for industry-specific identifiers using zero-shot learning.- Python
- JavaScript
- No training required - describe entities in natural language
- Works across any industry or domain
- Combine with 40+ pre-trained entity types
- Zero-shot detection adapts to your use case
Batch Processing
Process multiple texts efficiently in parallel.- Python
- JavaScript
- Use async/parallel processing for batches
- Implement rate limiting
- Use connection pooling
- Handle errors gracefully
Express.js Middleware
Create middleware to automatically protect routes.Best Practices Summary
1. Always Use Environment Variables
2. Handle Errors Gracefully
3. Store Mappings Securely
- Use encrypted session storage
- Implement TTL for mappings
- Clear mappings after use
4. Use Appropriate Methods
- Tokenize: When you need to restore data later
- Mask: For UI display
- Redact: For permanent removal
- Hash: For analytics identifiers
- Synthesize: For test data
5. Monitor Usage
- Track API usage in dashboard
- Set up rate limit alerts
- Monitor error rates
Cookbook
Complete, runnable examples you can clone and use as a starting point. Each example is a self-contained project with setup instructions.OpenAI + Python
Tokenize user messages before GPT, detokenize responses
OpenAI + Node.js
TypeScript/Node.js OpenAI integration
LangChain (Python)
PII-safe chains with RunnableLambda
LangChain (Node.js)
PII-safe LangChain.js chains with RunnableLambda
GDPR + OpenAI (Python)
EU region, gdpr_eu policy, batch processing
GDPR + OpenAI (Node.js)
EU region, gdpr_eu policy — TypeScript
HIPAA Chatbot (Python)
Multi-turn chat with hipaa_us policy, PHI redaction
HIPAA Chatbot (Node.js)
Multi-turn healthcare chatbot — TypeScript
E2B Data Analyst (Python)
AI writes analysis code from tokenized data, E2B runs it on real data
E2B Data Analyst (Node.js)
AI data analyst with E2B sandbox — TypeScript
FastAPI Middleware
Auto-tokenize request bodies in FastAPI
Express Middleware
Auto-tokenize request bodies in Express.js
RAG + OpenAI (Python)
PII-safe RAG with ChromaDB — redact at ingestion, tokenize at query
RAG + OpenAI (Node.js)
TypeScript RAG pipeline with ChromaDB and PII protection
RAG + LangChain (Python)
BlindfoldPIITransformer + blindfold_protect() with FAISS
RAG + LangChain (Node.js)
LangChain.js RAG with inline PII protection
RAG + LlamaIndex (Python)
Custom BlindfoldNodePostprocessor for LlamaIndex
RAG + LlamaIndex (Node.js)
LlamaIndex.TS RAG with PII protection
RAG Customer Support (Python)
GDPR multi-turn EU support chatbot with gdpr_eu policy
RAG Customer Support (Node.js)
TypeScript GDPR multi-turn EU support chatbot