added guardrails
Browse files- Dockerfile +10 -0
- app/requirements.txt +7 -3
Dockerfile
CHANGED
@@ -15,6 +15,16 @@ RUN pip install --no-cache-dir --upgrade -r app/requirements.txt
|
|
15 |
# ^ no caching of the packages to save space
|
16 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# RUN python -c "import nltk; nltk.download('stopwords')"
|
19 |
# ^ to fix runtime error, see https://github.com/run-llama/llama_index/issues/10681
|
20 |
# it didn't work, I had to do chmod below (as also suggested in the article)
|
|
|
15 |
# ^ no caching of the packages to save space
|
16 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
17 |
|
18 |
+
# pip install guardrails-ai first
|
19 |
+
# https://huggingface.co/docs/hub/spaces-sdks-docker#secrets
|
20 |
+
RUN --mount=type=secret,id=GUARDRAILS_TOKEN,mode=0444,required=true \
|
21 |
+
guardrails configure --token $(cat /run/secrets/GUARDRAILS_TOKEN) --no-metrics True
|
22 |
+
RUN guardrails hub install hub://guardrails/regex_match
|
23 |
+
RUN guardrails hub install hub://guardrails/toxic_language
|
24 |
+
RUN guardrails hub install hub://guardrails/detect_pii
|
25 |
+
RUN guardrails hub install hub://guardrails/qa_relevance_llm_eval
|
26 |
+
|
27 |
+
|
28 |
# RUN python -c "import nltk; nltk.download('stopwords')"
|
29 |
# ^ to fix runtime error, see https://github.com/run-llama/llama_index/issues/10681
|
30 |
# it didn't work, I had to do chmod below (as also suggested in the article)
|
app/requirements.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
requests==2.31.0
|
2 |
pydantic==2.7.1
|
3 |
pydantic_core==2.18.2
|
4 |
-
fastapi
|
5 |
-
uvicorn
|
6 |
pdfplumber==0.11.0
|
7 |
weaviate-client==4.5.4
|
8 |
PyPDF2==3.0.1
|
@@ -21,4 +21,8 @@ langchain-community==0.0.38
|
|
21 |
langchain-core==0.1.52
|
22 |
langchain-text-splitters==0.0.1
|
23 |
python-multipart==0.0.9
|
24 |
-
tenacity==8.2.3
|
|
|
|
|
|
|
|
|
|
1 |
requests==2.31.0
|
2 |
pydantic==2.7.1
|
3 |
pydantic_core==2.18.2
|
4 |
+
fastapi==0.110.0
|
5 |
+
uvicorn==0.20.0
|
6 |
pdfplumber==0.11.0
|
7 |
weaviate-client==4.5.4
|
8 |
PyPDF2==3.0.1
|
|
|
21 |
langchain-core==0.1.52
|
22 |
langchain-text-splitters==0.0.1
|
23 |
python-multipart==0.0.9
|
24 |
+
tenacity==8.2.3
|
25 |
+
typer
|
26 |
+
# https://hub.guardrailsai.com/tokens
|
27 |
+
guardrails-ai<=0.4.2 # API KEY doesn not work above that version
|
28 |
+
loguru==0.7.2 # used in reranker
|