Prompt Chain

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.

Works with huggingface

73
Spark score
out of 100
Updated 19 days ago
Version 0.121.18

Add to Favorites

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

01

Scan text content for PII patterns like names, emails, and phone numbers

02

Classify detected entities as specific PII types

03

Extract PII elements from unstructured text data

04

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

01
Set HF_API_TOKEN environment variable
02
Edit promptfooconfig.yaml
03
Run evaluation
04
View results

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.