redact_text
Detect and replace personally identifiable information (PII) in text with labeled placeholders to protect privacy before logging or sharing.
Instructions
Redact personally identifiable information (PII) from text.
Detects and replaces PII entities using NER and pattern matching.
Covers email addresses, phone numbers, full names, physical addresses,
credit card numbers, national ID numbers (UK NI, US SSN), dates of birth,
and IP addresses. Replacements use labelled placeholders so the structure
of the text is preserved for downstream processing.
Use before logging user input, storing support tickets, or sharing data
with third parties.
Args:
text: Text containing PII to redact. Handles mixed content including
structured data embedded in natural language.
Returns:
redacted: Text with PII replaced by [REDACTED_TYPE] placeholders.
entities: List of detected entities, each with:
type: Entity type (EMAIL, PHONE, NAME, ADDRESS, CREDIT_CARD, etc.).
original: The original value that was redacted.
start, end: Character positions in the original text.
entity_count: Total number of PII entities found and redacted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes |