For the complete documentation index, see llms.txt. This page is also available as Markdown.

PII Detection RAG Metric

Check LLM outputs for Personally Identifiable Information (names, emails, phone numbers) to prevent sensitive data leaks and ensure privacy compliance.

Objective: This guardrail ensures that any given text does not leak any Personally Identifiable Information. Currently, PIIs supported are:- 'EMAIL_ADDRESS' and 'URL'. If PII is detected, it will fail with a reason that anonymises the detected PII entities.

Required Parameters: Response

Interpretation: Higher score indicates the model response has PII exposed.

Code Execution:

Model and Provider parameters are not mandatory to run Guardrails.

The "schema_mapping" variable needs to be defined first and is a pre-requisite for evaluation runs. Learn how to set this variable here.

Example:

  • Response: John Doe's MRI results were sent to john.doe@hospital.com.

  • Metric Output: {‘score’: 1, ‘reason’: ‘John Doe’s MRI results were sent to EMAIL’}

Last updated

Was this helpful?