PII detection

How the PII detection rule finds personal data in agent traffic

PII Detection leverages the Presidio open source project to detect dozens of different PII categories. Users can use this guardrail to define which types of PII categories they want to block if detected, and it can be applied to both input and model output. The higher the confidence parameter is configured, the more significant indication is required for the algorithm to classify a given text as a PII element, resulting in fewer violations.

SUPERWISE guardrails: the PII detection rule form with apply to input or output, PII categories, and a confidence slider

Using the SDK

from superwise_api.models.agent.agent import AgentPiiDetectionGuard

restricted_topics_guard = AgentPiiDetectionGuard(
    name="Rule name",
    tags={"input", "output"}, # A Set containing "input", "output", or both
    threshold=0.5,
    categories={"CREDIT_CARD"} # Set of PII categories, see https://microsoft.github.io/presidio/supported_entities/.
)


Did this page help you?