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

update unauthorized hub errors to include instructions #1066

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

dtam
Copy link
Contributor

@dtam dtam commented Sep 11, 2024

import guardrails as gr

from guardrails.hub import DetectPII

guard = gr.Guard()
guard.use_many(DetectPII(pii_entities=['PERSON', 'LOCATION']))

completion = guard(
    messages=[
        {
            "role": "user",
            "content": "Tell me about a city in california."
        }
    ],
    model="gpt-4o-mini"
)

print(completion)

should yield

Exception: 401: Remote Inference Unauthorized. Please run `guardrails configure`. You can find a new token at https://hub.guardrailsai.com/keys

and

guardrails hub install hub://guardrails/profanity_free

returns

Installing hub://guardrails/profanity_free...
401
Unauthorized
Your token is invalid. Please run `guardrails configure`to update your token.
You can find a new token at https://hub.guardrailsai.com/keys

@CalebCourier CalebCourier merged commit 49fd8f6 into main Sep 12, 2024
12 checks passed
@CalebCourier CalebCourier deleted the dtam/better_unauthorized_errors branch September 12, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants