# 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="/files/ybS7VtzodElaYKlUcWir" 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](/ragaai-catalyst/concepts/running-ragaai-evals/executing-evaluations.md).

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/rag-metrics/pii-detection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
