> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PII Detection

> Detect and manage PII in LLM interactions with TrueFoundry's guardrails

PII (Personally Identifiable Information) detection refers to the process of identifying and locating personal information within a text or data source that can be used to distinguish or trace an individual's identity.

#### Why is PII detection important?

* **Data privacy and security:** Detecting PII helps organizations protect sensitive information and comply with regulations such as GDPR and CCPA.
* **Risk mitigation:** Identifying and securing PII can prevent data breaches and other security incidents.
* **Compliance:** Many regulations require organizations to protect PII, and detection is the first step toward achieving compliance.

#### Truefoundry's PII detection solutions

* [AWS Bedrock Guardrails](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html)\
  You can use the Bedrock integration on Truefoundry to achieve PII detection. A brief tutorial for setting this up is provided at the end of this page.

* [Open-source Presidio](https://github.com/microsoft/presidio)\
  You can also implement PII detection using the custom guardrail integration option on Truefoundry Gateway. As a starting point, refer to the Truefoundry Guardrail Template Repository, which already includes PII redaction using Presidio. This template can be extended to suit your specific requirements.

* [Guardrails.io](https://hub.guardrailsai.com/validator/guardrails/detect_pii)\
  Similarly, Guardrails.io functionality can be achieved by building a custom guardrail using the same template repository. The template provides a foundation for integrating additional PII detection or redaction logic as needed.

<Note>
  Link to the [Truefoundry Guardrail Template Repository](https://github.com/truefoundry/custom-guardrails-template)
</Note>

### How to setup PII detection using Bedrock Guardrails on Truefoundry?

<iframe href="https://app.supademo.com/embed/cmd49280o4ekoc4kj21rofbyk" typeofembed="iframe" height="475px" width="100%" provider="app.supademo.com" src="https://app.supademo.com/embed/cmd49280o4ekoc4kj21rofbyk" style={{ border: "none", display: "flex", margin: "auto" }} />

* Create guardrail on Bedrock, with sensitive information filter with Input & Ouput action as `Block`

<Frame>
  <img src="https://mintcdn.com/truefoundry/iMid4yIOHvzf4Z4V/images/pii-detection-1.jpeg?fit=max&auto=format&n=iMid4yIOHvzf4Z4V&q=85&s=44a3e205b2e17438fda2924258e54534" alt="PII Detection" width="1280" height="621" data-path="images/pii-detection-1.jpeg" />
</Frame>

* Create a new or Add to an existing guardrail group on Truefoundry Gateway **(AI Gateway -> Guardrails -> Add New Guardrail Group or Add/Edit Guardrails)**
* Add bedrock guardrail and fill the details such as:
  * Name
  * GuardrailID
  * Version
  * Region
  * Auth Data (AWS Access Key ID and Secret Access Key or ARN Based Credentials)
* Create a new or Edit existing guardrail configuration on Truefoundry Gateway **(AI Gateway -> Config -> Guardrail -> Create/Edit)**
* Test out the guardrail in playground **(AI Gateway -> Playground)**
