Skip to main content

Detect personal data

Find personal data in text (emails, phone, card and ID numbers, IBANs, IP addresses; with a model also names and addresses) and give a masked copy. Patterns work without a model; numbers with a check digit must pass it.

Command in the Generative AI toolkit · id ooa.genai/detect_pii · 13 inputs (1 required), 5 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
TextStringYesText to check, e.g. an email body or a document's text.
KindsListNoOnly these kinds: email, phone, credit_card, iban, ip_address, us_ssn, in_pan, in_aadhaar, person_name, address (the last two need use_ai). Every kind when empty (names and addresses only with use_ai).
Use AIBooleanNofalseAlso ask the model for people's names and postal addresses; the patterns still find the rest without it.
Mask charStringNo*The one character that replaces masked characters.
Mask styleStringNopartialpartial keeps a little so values can be told apart (j***@acme.com, last 4 digits of numbers); full masks every character.
ProviderStringNoopenaiWho runs the model: OpenAI, Azure OpenAI, Anthropic, OpenAI-compatible (LiteLLM, vLLM, Ollama), Hugging Face (its router or your own TGI server), AWS SageMaker (a model on an Amazon SageMaker endpoint), AWS Bedrock or Google Vertex AI (Gemini).
ConnectionStringNoName of a Model Connection (provider, model and key managed in one place). Leave empty to set them on this action.
ModelStringNoModel name; the deployment name for Azure OpenAI; the endpoint name for AWS SageMaker; the model or inference profile id for AWS Bedrock.
API keyCredentialNoAPI key or access token from the vault (not needed for some self-hosted endpoints). For AWS Bedrock and AWS SageMaker: the AWS secret access key (or ACCESS_KEY_ID:SECRET). For Google Vertex AI: a service-account JSON key or an access token.
Endpoint addressStringNoEndpoint; required for Azure OpenAI, Vertex AI (https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/REGION) and self-hosted models (for a TGI server, e.g. http://tgi-host:8080/v1).
Hide personal dataBooleanNotrueReplace emails, phone and card numbers, IBANs and similar before sending; restored in the answer. Only used with use_ai; the model then sees the patterns' finds as placeholders.
AWS access key IDCredentialNoAWS Bedrock and AWS SageMaker only: AWS access key id from the vault (api_key then holds the secret access key).
AWS regionStringNoAWS Bedrock and AWS SageMaker only: AWS region, e.g. eu-west-1.

Outputs​

OutputTypeWhat it is
foundBooleanTrue when any personal data was found.
countNumberHow many pieces were found.
itemsListEach piece as {kind, text, start, end}, in text order and never overlapping; start counts from 0 and end is just past the last character.
masked_textStringThe text with every piece found masked.
kinds_foundListEach kind found, once, e.g. ["email", "phone"].