Detect and Extract PII from Text Using Hugging Face
Automatically detect and extract personally identifiable information from text using Hugging Face models for privacy compliance.
Why it matters
Identify and extract personally identifiable information (PII) from text data to ensure compliance with privacy regulations and protect sensitive user information.
Outcomes
What it gets done
Scan text content for PII patterns like names, emails, and phone numbers
Classify detected entities as specific PII types
Extract PII elements from unstructured text data
Evaluate PII detection accuracy across test cases
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-pii | bash Steps
Steps in the chain
Overview
Pii
A Promptfoo example demonstrating PII detection evaluation with Hugging Face models Use when you want a working example of configuring and running PII detection tests through Promptfoo with Hugging Face
What it does
This is a ready-to-run Promptfoo example that demonstrates how to work with PII detection using Hugging Face models. It provides a workflow with configuration files and evaluation commands.
When to use - and when NOT to
Use this when you want to explore a working example of PII detection testing with Hugging Face models through Promptfoo. Use it as a starting point for understanding how to configure and run evaluations.
Do not use this if you need a production-ready PII redaction service - this is an example workflow, not a deployment-ready solution. Do not use it if you require models outside the Hugging Face ecosystem.
Inputs and outputs
You provide a Hugging Face API token (HF_API_TOKEN environment variable) and edit the promptfooconfig.yaml file to configure your evaluation. The workflow runs your configured tests and generates results that you can view using the Promptfoo viewer.
Integrations
This example requires a Hugging Face API token and uses Promptfoo's evaluation framework.
Who it's for
This workflow is built for developers and engineers who want to see a working example of PII detection testing with Hugging Face models using Promptfoo.
To get started, run:
npx promptfoo@latest init --example huggingface/pii
cd huggingface/pii
Set your HF_API_TOKEN environment variable, edit the configuration file, then execute:
promptfoo eval
After evaluation completes, view results by running promptfoo view.
Source README
huggingface/pii (Huggingface Pii)
You can run this example with:
npx promptfoo@latest init --example huggingface/pii
cd huggingface/pii
Usage
To get started, set your HF_API_TOKEN environment variable.
Next, edit promptfooconfig.yaml.
Then run:
promptfoo eval
Afterwards, you can view the results by running promptfoo view
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.