# PII Detection RAG Metric

**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.

<figure><img src="https://1811327582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYbIiNdp1QbG4avl7VShw%2Fuploads%2Fw7LtQXhMPPtLWh2yjRko%2FScreenshot%202024-10-04%20at%209.06.20%E2%80%AFAM.png?alt=media&#x26;token=d60380de-a7fa-4600-8ea2-d58322bb6cc7" alt=""><figcaption></figcaption></figure>

**Code Execution:**

```python
metrics=[
    {"name": "PII", "config": {"model": "gpt-4o-mini", "provider": "openai"}, "column_name": "your-column-identifier", "schema_mapping": schema_mapping}
]
```

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](https://docs.raga.ai/ragaai-catalyst/concepts/running-ragaai-evals/executing-evaluations).

**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’}

{% hint style="warning" %}
Model and Provider parameter are not required to run Guardrails
{% endhint %}
