Example code and guides for Blindfold — the privacy API that protects PII in AI applications.
Each example is a self-contained project you can clone and run. They show how to integrate Blindfold with popular LLM providers and frameworks.
Resources: Documentation | Python SDK | Node.js SDK | Java SDK | Go SDK | .NET SDK | CLI | MCP Server
- Copy
.env.exampleto.envin the example directory - Add your
OPENAI_API_KEY(required for LLM calls) - Optionally add
BLINDFOLD_API_KEYfrom app.blindfold.dev
Offline mode: All examples work without a
BLINDFOLD_API_KEY. When omitted, PII detection runs locally using built-in regex patterns. NLP-only entities (Person, Organization) require an API key.
Examples showing how to protect PII when calling LLM APIs.
| Provider | Description | Python | TypeScript | Java | Go | .NET |
|---|---|---|---|---|---|---|
| OpenAI | Tokenize user messages before GPT, detokenize responses | openai-python | openai-node | openai-java | openai-go | openai-dotnet |
| Anthropic Claude | Tokenize user messages before Claude, detokenize responses | anthropic-python | anthropic-node | — | — | — |
| Google Gemini | Tokenize user messages before Gemini, detokenize responses | gemini-python | gemini-node | — | — | — |
| LangChain | PII-safe chains with RunnableLambda | langchain-python | langchain-node | — | — | — |
End-to-end examples for building regulation-compliant AI applications.
| Regulation | Description | Region | Python | TypeScript |
|---|---|---|---|---|
| GDPR | EU-compliant OpenAI integration with gdpr_eu policy, batch processing |
EU | gdpr-openai-python | gdpr-openai-node |
| HIPAA | Healthcare chatbot protecting PHI with hipaa_us policy, multi-turn chat |
US | hipaa-healthcare-chatbot | hipaa-healthcare-chatbot-node |
Middleware that automatically protects PII in web applications.
| Framework | Description | Python | TypeScript |
|---|---|---|---|
| Express.js | Middleware that tokenizes request bodies, detokenizes responses | — | express-middleware |
| FastAPI | Middleware that tokenizes request bodies, stores mapping on request.state | fastapi-middleware | — |
Examples showing how to safely give AI agents access to sensitive data.
| Platform | Description | Python | TypeScript |
|---|---|---|---|
| E2B | AI data analyst — OpenAI writes code from tokenized CSV, E2B executes on real data | e2b-data-analyst | e2b-data-analyst-node |
PII-safe Retrieval-Augmented Generation with two-layer protection: redact at ingestion, tokenize at query time.
| Framework | Description | Python | TypeScript |
|---|---|---|---|
| OpenAI + ChromaDB | Plain OpenAI RAG with ingestion-time redaction and query-time tokenization | rag-openai-python | rag-openai-node |
| LangChain + FAISS | BlindfoldPIITransformer for documents, blindfold_protect() for chains |
rag-langchain-python | rag-langchain-node |
| LlamaIndex | Custom BlindfoldNodePostprocessor tokenizes retrieved nodes before the LLM |
rag-llamaindex-python | rag-llamaindex-node |
| GDPR Customer Support | Multi-turn EU support chatbot with gdpr_eu policy, multilingual PII |
rag-customer-support-python | rag-customer-support-node |
User message Tokenized message AI response
"Email [email protected]" → "Email <Email Address_1>" → "I'll email <Email Address_1>"
↓
"I'll email [email protected]"
- Tokenize — PII is replaced with safe tokens before data leaves your system
- Process — The AI model only sees anonymized text
- Detokenize — Original values are restored in the response
Contributions are welcome! If you have an integration example to share, open a pull request.
MIT