Skip to main content

What is Phone Number Policy?

Phone number policies specifically detect and anonymize phone numbers in various formats (US, international, etc.).

Usage

from upsonic import Agent, Task
from upsonic.safety_engine.policies import AnonymizePhoneNumbersPolicy

# Anonymize just phone numbers
agent = Agent(
    model="openai/gpt-4o",
    agent_policy=AnonymizePhoneNumbersPolicy,
    debug=True
)

task = Task("My Number is: +1-555-123-4567. Tell me what is my number.")
result = agent.do(task)
# Output: "Your number is: XXX-XXXX."

Available Variants

  • AnonymizePhoneNumbersPolicy: Pattern-based detection and anonymization
  • AnonymizePhoneNumbersPolicy_LLM_Finder: LLM-powered detection for better accuracy

Params

No custom parameters. Uses built-in phone number patterns.