jevrecipes

Recipe catalog / pii-presence

Detect personal information

pii-presence is a Jev recipe from the jev-recipes TypeScript package. Does text contain information identifying a specific private individual? Use it when you need a yes/no gate before storing, logging, sharing, or sending text that might contain personal data.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I use pii-presence in TypeScript?

Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.

import { piiPresence } from 'jev-recipes/pii-presence';

const result = await piiPresence({
  "text": "Hi, this is Dana Whitfield. My account number is 44-9921 and you can reach me at 555-0142 about the refund.",
  "minConfidence": 0.8
});
console.log(result);

What input does pii-presence take?

FieldTypeNeeded
textstringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "text": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "text"
    ]
  },
  "result": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "model": {
        "type": "string"
      },
      "usage": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "output_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "input_tokens",
          "output_tokens"
        ],
        "additionalProperties": false
      },
      "status": {
        "type": "string",
        "enum": [
          "ready",
          "review"
        ]
      },
      "probability": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "verdict": {
        "type": "string",
        "enum": [
          "present",
          "absent"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "probability",
      "confidence",
      "verdict"
    ],
    "additionalProperties": false
  }
}

What does a pii-presence result look like?

This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo pii-presence.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "probability": 0.96,
  "confidence": 0.96,
  "verdict": "present"
}

Input

See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.

Result

verdict is present when Jev's yes probability is at least 0.5 and absent otherwise. probability is that yes probability. confidence is the probability of the chosen side, so a 0.1 yes probability yields absent with 0.9 confidence.

A result is ready when confidence meets minConfidence. Otherwise it is review. Treat a review result as unknown and fall back to your safe default, such as redacting or withholding the text.

Reuse and calls

Uses the shared gate helper, a single yes/no question. This folder owns the question wording, the outcome descriptions, and the review policy. A live invocation makes one logical Jev request.

Limits

The recipe says whether identifying information is present, not where it is. Use a pattern-based redactor or an extraction step to locate spans. It judges identifiability semantically, so a first name alone is usually absent while a name with a phone number is present. Legal definitions of personal data differ by jurisdiction; encode the one you need in application policy.

Example input

demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo pii-presence shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe pii-presence to inspect the input and result schemas.

How accurate is pii-presence?

Current measurement; labels unspecified

jev-1.13.0 / 2026-10-04 / 43 development cases

Scoring revision 2.

95%All-case accuracy
7Sent for review
0Failed calls / cases

36 ready decisions, with 100% accuracy among those decisions.

95% case-level interval: 85% to 99%. Related synthetic cases are correlated.

This measures the recorded dataset, not general readiness. Label sources: unspecified: Not recorded by the dataset author.

Use the evaluation guide to measure this decision on your own labeled cases.

What are the limits of pii-presence?