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

[bug] guardrailshub is very inconsistent when using them in docker. #1181

Open
pack0shades opened this issue Dec 4, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@pack0shades
Copy link

pack0shades commented Dec 4, 2024

the guradrails hub is not working as expected it is giving 403 error for token authentication even if you create a fresh api while installing regex_match, and toxic_language in docker container
To Reproduce
Steps to reproduce the behavior:

  1. make a dockerfile

ARG GUARDRAILS_API_KEY

ENV GUARDRAILS_API_KEY=${GUARDRAILS_API_KEY}

RUN pip install guardrailsai[api]

RUN guardrails configure --enable-metrics --enable-remote-inferencing --token $GUARDRAILS_API_KEY

RUN guardrails hub install hub://guardrails/regex_match

RUN guardrails hub install hub://guardrails/toxic_language

Expected behavior
it should be installing regexMatch and toxicLanguage validators but not working

Library version:
Version 0.5.15

@pack0shades pack0shades added the bug Something isn't working label Dec 4, 2024
@pack0shades pack0shades reopened this Dec 4, 2024
@pack0shades
Copy link
Author

nothing is given in the documentations regarding the issue

@CalebCourier
Copy link
Collaborator

CalebCourier commented Dec 9, 2024

Hi @pack0shades,

We're currently unable to reproduce this error with the information you included in the issue description. Would you mind providing the below additional context so we can better debug?

  1. A more complete Dockerfile, for example:
    • Are you using a virtual environment like we recommend in our documentation?
    • What version of guardrails-ai are you installing? You mention in the description this is for version 0.5.15, but in the code snippet you are not locking the version during install which currently would bring in 0.6.0.
  2. Where are you running the docker build?
    • Are you behind a firewall?
    • Is it running in an AWS VPC?
    • Is there a reliable internet connection?
  3. Can you confirm the API Key you're using is not expired? i.e. does it work if you use it locally?

For context, here is the Dockerfile and build script I'm using without any errors. Note that I am running this on a Macbook Pro on a typical network connection (i.e. not a firewalled or corporate network):

Dockerfile

FROM public.ecr.aws/docker/library/python:3.12-slim

ARG CACHE_BUST

ARG GUARDRAILS_API_KEY
ENV GUARDRAILS_API_KEY=${GUARDRAILS_API_KEY}

RUN apt-get update
RUN apt-get install -y git

RUN pip install guardrails-ai[api]==0.5.15 gunicorn[gthread]

RUN which guardrails

RUN guardrails configure --enable-metrics --enable-remote-inferencing --token $GUARDRAILS_API_KEY

RUN guardrails hub install hub://guardrails/regex_match

RUN guardrails hub install hub://guardrails/toxic_language

CMD gunicorn --bind 0.0.0.0:8000 --timeout=90 --workers=2 "guardrails_api.app:create_app(None, None, 8000)"

Build command

docker build --progress=plain -t latest --build-arg GUARDRAILS_API_KEY="$GUARDRAILS_PROD_TOKEN" --build-arg CACHE_BUST="$(date)" .

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

2 participants