Guardrails Blindfold
A Guardrails AI validator that detects and protects PII in LLM outputs using the Blindfold API.
| Developed by | Blindfold |
| License | MIT |
| Input/Output | String |
| Hub | blindfold/pii_protection |
Installation
pip install guardrails-blindfold
Set your Blindfold API key:
export BLINDFOLD_API_KEY=your-api-key
Get a free API key at app.blindfold.dev.
Quick Start
from guardrails import Guard
from guardrails_blindfold import BlindfoldPII
guard = Guard().use(BlindfoldPII(on_fail="fix"))
result = guard.validate("Contact John Doe at john@example.com")
print(result.validated_output)
# → "Contact <Person_1> at <Email Address_1>"
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
policy |
str |
"basic" |
Detection policy — see table below |
pii_method |
str |
"tokenize" |
How to fix detected PII |
region |
str |
None |
"eu" or "us" for data residency |
entities |
list |
None |
Specific entity types to detect |
score_threshold |
float |
None |
Confidence threshold (0.0–1.0) |
api_key |
str |
None |
Falls back to BLINDFOLD_API_KEY env var |
on_fail |
str |
None |
Guardrails failure action |
Policies
| Policy | Entities | Use Case |
|---|---|---|
basic |
Names, emails, phones, locations | General PII protection |
gdpr_eu |
EU-specific: IBANs, addresses, dates of birth | GDPR compliance |
hipaa_us |
PHI: SSNs, MRNs, medical terms | HIPAA compliance |
pci_dss |
Card numbers, CVVs, expiry dates | PCI DSS compliance |
strict |
All entity types, lower threshold | Maximum detection |
PII Methods
| Method | Description | Reversible |
|---|---|---|
tokenize |
Replace with tokens (<Person_1>) |
Yes |
redact |
Remove permanently ([REDACTED]) |
No |
mask |
Partially hide (J****oe) |
No |
hash |
Deterministic hash (HASH_abc123) |
No |
synthesize |
Replace with fake data (Jane Smith) |
No |
encrypt |
AES-256 encryption | Yes (with key) |
Examples
GDPR Compliance (EU Region)
guard = Guard().use(
BlindfoldPII(
policy="gdpr_eu",
region="eu",
on_fail="fix",
)
)
result = guard.validate("Email hans.mueller@example.de about the meeting")
# → "Email <Email Address_1> about the meeting"
HIPAA — Redact PHI
guard = Guard().use(
BlindfoldPII(
policy="hipaa_us",
pii_method="redact",
region="us",
on_fail="fix",
)
)
result = guard.validate("Patient John Smith, SSN 123-45-6789")
# → "Patient [REDACTED], SSN [REDACTED]"
Block Output if PII Detected
guard = Guard().use(
BlindfoldPII(policy="strict", on_fail="exception")
)
# Raises ValidationError if PII is found
result = guard.validate("No PII here") # passes
result = guard.validate("Email john@example.com") # raises
Chain with Other Validators
from guardrails_blindfold import BlindfoldPII
guard = Guard().use(
BlindfoldPII(policy="strict", on_fail="fix"),
).use(
AnotherValidator(on_fail="exception"),
)
Detect Specific Entity Types
guard = Guard().use(
BlindfoldPII(
entities=["Email Address", "Phone Number"],
on_fail="fix",
)
)
Data Residency
Use the region parameter to ensure PII is processed in a specific jurisdiction:
region="eu"— processed in Frankfurt, Germanyregion="us"— processed in Virginia, US
# EU data stays in the EU
guard = Guard().use(
BlindfoldPII(policy="gdpr_eu", region="eu", on_fail="fix")
)
Links
Metadata
Release files for guardrails-blindfold 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| guardrails_blindfold-0.1.0.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| guardrails_blindfold-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / guardrails_blindfold-0.1.0.tar.gz
| Download URL | guardrails_blindfold-0.1.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
026e7b49cc4569ea98a9bd7249d4f6f2df001148ef750a2a8379b41cedf41a04
|
|
BLAKE2b-256 checksum How to use checksums |
d1115de9bad93754d6fd856e46e0d5746aa29e190c4959add18b07c1144d1f23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / guardrails_blindfold-0.1.0-py3-none-any.whl
| Download URL | guardrails_blindfold-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c97c25db46d806b89da7613645ccab3727cdfe343281133f91ab8e6dd989f33a
|
|
BLAKE2b-256 checksum How to use checksums |
9ae0a5f1bf2ec244054f8858bbc9453b6e0362994220a23fbcf46dc7c5e9b02a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|