Text Sanitizer
The Text Sanitizer component detects and masks sensitive content in input text, replacing matched values with labeled placeholders and returning a mapping of placeholders back to their original values.
Unlike the Guardrails component, which blocks or passes input based on policy violations, the Text Sanitizer always passes the text through — but with sensitive content replaced. This makes it useful for anonymizing data before it reaches an LLM, logging pipeline, or external service.
For example, the text Call me at 555-123-4567 becomes Call me at <PHONE_NUMBER_1>, and the mapping {"<PHONE_NUMBER_1>": "555-123-4567"} is returned alongside the sanitized text.
Supported detection types
Select one or more guardrails to activate. Each guardrail reveals its own configuration options:
- Personal Data (PII): Detects names, phone numbers, email addresses, credit card numbers, IBAN codes, TCKN, locations, IP addresses, and date/time values. You can select specific PII types or choose All.
- Keywords: Masks exact keyword or phrase matches. Enter values separated by commas.
- URLs: Detects and masks URLs. You can configure which URL schemes are allowed (for example, allow
httpsbut maskhttporjavascript), and add exception patterns for trusted domains. - Custom Regex: Define one or more regex patterns with optional labels. Each match is replaced with a placeholder based on the label.
Use the Text Sanitizer in a flow
- Add a Text Sanitizer component to your flow.
- Connect a Chat Input, Text Input, or any
Messagesource to the Input Text port. - In the Guardrails field, select the detection types you want to enable.
- Configure the options that appear for each selected guardrail.
- Connect the Sanitized Output port to the next component in your flow.
The output is a Data object with two keys:
text: The sanitized text with placeholders substituted in place of sensitive content.masking_mapping: A dictionary mapping each placeholder back to its original value.
To restore the original values later in your flow, you can reference masking_mapping from a Parser or Python Interpreter component.
Text Sanitizer parameters
Some parameters are hidden by default in the visual editor. You can modify all component parameters through the component inspection panel that appears when you select a component.
| Name | Type | Description |
|---|---|---|
| Guardrails | Multiselect | Input parameter. The detection types to enable: Personal Data (PII), Keywords, URLs, Custom Regex. |
| PII Detection Type | Multiselect | Input parameter. Shown when PII is selected. Choose specific PII categories or All. |
| Keywords | Text | Input parameter. Shown when Keywords is selected. Comma-separated list of keywords or phrases to mask. |
| Exception URLs | Text | Input parameter. Shown when URLs is selected. Comma-separated URL patterns to allow through unmasked. |
| Allowed Schemes | Multiselect | Input parameter. Shown when URLs is selected. URL schemes to allow; others are masked. Defaults to https. |
| Regex Patterns | Table | Input parameter. Shown when Custom Regex is selected. One row per pattern, with a label and a regex pattern. |
| Input Text | Message | Input parameter. The text to sanitize. |
| Sanitized Output | Data | Output parameter. Contains text (sanitized string) and masking_mapping (placeholder-to-original dictionary). |