guardrails-blindfold package integrates Blindfold with Guardrails AI, letting you add PII protection to any Guard with one line. Detect and fix PII in LLM outputs automatically.
Installation
Quick Start
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
policy | str | "basic" | Detection policy |
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 | Best For |
|---|---|---|
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
Thepii_method parameter controls how detected PII is fixed when on_fail="fix":
| Method | Output | Reversible |
|---|---|---|
tokenize | <Person_1>, <Email Address_1> | Yes |
redact | PII removed entirely | No |
mask | J****oe, j****om | No |
hash | HASH_abc123 | No |
synthesize | Jane Smith, jane@example.org | No |
encrypt | AES-256 encrypted value | Yes (with key) |
Usage Examples
GDPR Compliance with EU Region
HIPAA — Redact PHI
Block Output if PII Detected
Useon_fail="exception" to raise an error instead of fixing:
Detect Specific Entity Types
Chain with Other Validators
Blindfold can be combined with any other Guardrails validator:Protect LLM Output in a Chain
On-Fail Actions
Guardrails supports several failure handling strategies:| Action | Behavior |
|---|---|
fix | Replace PII with the protected version (tokenized, redacted, etc.) |
exception | Raise ValidationError — blocks the output entirely |
noop | Log the failure but return the original output unchanged |
reask | Re-prompt the LLM to regenerate without PII |
Data Residency
Use theregion parameter to ensure PII is processed in a specific jurisdiction:
| Region | Endpoint | Location |
|---|---|---|
eu | eu-api.blindfold.dev | Frankfurt, Germany |
us | us-api.blindfold.dev | Virginia, US |