Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phone number detection doesn't work without area code #3

Open
CalebCourier opened this issue Mar 6, 2024 · 0 comments
Open

Phone number detection doesn't work without area code #3

CalebCourier opened this issue Mar 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@CalebCourier
Copy link
Contributor

from guardrails.hub import DetectPII

pii_guard = DetectPII(
    pii_entities=["PHONE_NUMBER"],
    on_fail="fix"
)

long_phone_number = "555 867 5309"

long_result = pii_guard.validate(long_phone_number, {})

# This correctly fails
assert long_result.outcome == "fail"


short_phone_number = "867 5309"

short_result = pii_guard.validate(short_phone_number, {})

# This should fail but it doesn't!
assert short_result.outcome == "fail", f"Expected short_result.outcome to be \"fail\" but it was \"{short_result.outcome}\" instead!"
@CalebCourier CalebCourier added the bug Something isn't working label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant