PII Detection

Objective: This guardrail ensures that any given text does not leak any Personally Identifiable Information. Currently, PIIs supported are:- 'EMAIL_ADDRESS' and 'URL'. If PII is detected, it will fail with a reason that anonymises the detected PII entities.

Required Parameters: Response

Interpretation: Higher score indicates the model response has PII exposed.

Code Execution:

experiment_manager = Experiment(project_name="project_name",
                                experiment_name="experiment_name",
                                dataset_name="dataset_name")

# Hallucination Test
response =  experiment_manager.add_metrics(
    metrics=[
        {"name":"PII", "config": {"reason": True, "batch_size" : 5}}
    ]
)

Refer Executing tests page to learn about Metric Configuration

Example:

  • Response: John Doe's MRI results were sent to john.doe@hospital.com.

  • Metric Output: {‘score’: 1, ‘reason’: ‘John Doe’s MRI results were sent to EMAIL’}

Model and Provider parameter are not required to run Guardrails

Last updated