Skip to main content

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, Germany
  • region="us" — processed in Virginia, US
# EU data stays in the EU
guard = Guard().use(
    BlindfoldPII(policy="gdpr_eu", region="eu", on_fail="fix")
)

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guardrails_blindfold-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guardrails_blindfold-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file guardrails_blindfold-0.1.0.tar.gz.

File metadata

  • Download URL: guardrails_blindfold-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for guardrails_blindfold-0.1.0.tar.gz
Algorithm Hash digest
SHA256 026e7b49cc4569ea98a9bd7249d4f6f2df001148ef750a2a8379b41cedf41a04
MD5 0b5998bb2ff445d7e04203ca85509db9
BLAKE2b-256 d1115de9bad93754d6fd856e46e0d5746aa29e190c4959add18b07c1144d1f23

See more details on using hashes here.

File details

Details for the file guardrails_blindfold-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for guardrails_blindfold-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c97c25db46d806b89da7613645ccab3727cdfe343281133f91ab8e6dd989f33a
MD5 1c863be3375130b76fafcaa61a8e6669
BLAKE2b-256 9ae0a5f1bf2ec244054f8858bbc9453b6e0362994220a23fbcf46dc7c5e9b02a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page