From 6ce65514e1c3942786254af315a8f5bd7f00eac3 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Thu, 12 Sep 2024 13:24:50 +0800 Subject: [PATCH] replace langchain/langchain:latest with python:3.11-slim (#669) * replace langchain/langchain:latest with python:3.11-slim Signed-off-by: chensuyue * fix test Signed-off-by: chensuyue --------- Signed-off-by: chensuyue --- comps/embeddings/mosec/langchain/Dockerfile | 2 +- .../embeddings/multimodal/multimodal_langchain/Dockerfile | 2 +- comps/embeddings/multimodal_clip/Dockerfile | 2 +- comps/embeddings/tei/langchain/Dockerfile | 2 +- comps/guardrails/llama_guard/langchain/Dockerfile | 2 +- comps/guardrails/toxicity_detection/Dockerfile | 2 +- comps/intent_detection/langchain/Dockerfile | 2 +- comps/knowledgegraphs/langchain/Dockerfile | 2 +- comps/llms/faq-generation/tgi/langchain/Dockerfile | 2 +- comps/llms/summarization/tgi/langchain/Dockerfile | 2 +- comps/llms/text-generation/ollama/langchain/Dockerfile | 2 +- comps/llms/text-generation/tgi/Dockerfile | 2 +- comps/llms/text-generation/vllm/langchain/Dockerfile | 2 +- comps/llms/text-generation/vllm/ray/Dockerfile | 2 +- comps/ragas/tgi/langchain/Dockerfile | 2 +- comps/reranks/mosec/langchain/Dockerfile | 2 +- comps/retrievers/multimodal/redis/langchain/Dockerfile | 2 +- comps/retrievers/pathway/langchain/Dockerfile | 2 +- comps/retrievers/pgvector/langchain/Dockerfile | 2 +- comps/retrievers/pinecone/langchain/Dockerfile | 2 +- comps/retrievers/redis/langchain/Dockerfile | 2 +- comps/retrievers/vdms/langchain/Dockerfile | 2 +- comps/web_retrievers/chroma/langchain/Dockerfile | 2 +- tests/llms/test_llms_text-generation_tgi.sh | 8 ++++---- tests/retrievers/test_retrievers_pinecone_langchain.sh | 2 +- tests/retrievers/test_retrievers_redis_langchain.sh | 3 ++- 26 files changed, 30 insertions(+), 29 deletions(-) diff --git a/comps/embeddings/mosec/langchain/Dockerfile b/comps/embeddings/mosec/langchain/Dockerfile index 57d21cbd2..6868fd57d 100644 --- a/comps/embeddings/mosec/langchain/Dockerfile +++ b/comps/embeddings/mosec/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/embeddings/multimodal/multimodal_langchain/Dockerfile b/comps/embeddings/multimodal/multimodal_langchain/Dockerfile index 923495add..be0cad944 100644 --- a/comps/embeddings/multimodal/multimodal_langchain/Dockerfile +++ b/comps/embeddings/multimodal/multimodal_langchain/Dockerfile @@ -2,7 +2,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/embeddings/multimodal_clip/Dockerfile b/comps/embeddings/multimodal_clip/Dockerfile index aefba8aad..6f45a81b2 100644 --- a/comps/embeddings/multimodal_clip/Dockerfile +++ b/comps/embeddings/multimodal_clip/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/embeddings/tei/langchain/Dockerfile b/comps/embeddings/tei/langchain/Dockerfile index b4a63d28e..7b30734ad 100644 --- a/comps/embeddings/tei/langchain/Dockerfile +++ b/comps/embeddings/tei/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/guardrails/llama_guard/langchain/Dockerfile b/comps/guardrails/llama_guard/langchain/Dockerfile index 15027b3ee..63988cc4e 100644 --- a/comps/guardrails/llama_guard/langchain/Dockerfile +++ b/comps/guardrails/llama_guard/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ENV LANG=C.UTF-8 diff --git a/comps/guardrails/toxicity_detection/Dockerfile b/comps/guardrails/toxicity_detection/Dockerfile index 98dc0c053..897e62a23 100644 --- a/comps/guardrails/toxicity_detection/Dockerfile +++ b/comps/guardrails/toxicity_detection/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ENV LANG=C.UTF-8 diff --git a/comps/intent_detection/langchain/Dockerfile b/comps/intent_detection/langchain/Dockerfile index 297b1b88f..b19f37132 100644 --- a/comps/intent_detection/langchain/Dockerfile +++ b/comps/intent_detection/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/knowledgegraphs/langchain/Dockerfile b/comps/knowledgegraphs/langchain/Dockerfile index 649ff023a..9a6a85d00 100644 --- a/comps/knowledgegraphs/langchain/Dockerfile +++ b/comps/knowledgegraphs/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" # Set this to "cpu" or "gpu" diff --git a/comps/llms/faq-generation/tgi/langchain/Dockerfile b/comps/llms/faq-generation/tgi/langchain/Dockerfile index 990f41040..2cf7fa80c 100644 --- a/comps/llms/faq-generation/tgi/langchain/Dockerfile +++ b/comps/llms/faq-generation/tgi/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/llms/summarization/tgi/langchain/Dockerfile b/comps/llms/summarization/tgi/langchain/Dockerfile index 363df42e8..0fbc4e5ad 100644 --- a/comps/llms/summarization/tgi/langchain/Dockerfile +++ b/comps/llms/summarization/tgi/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/llms/text-generation/ollama/langchain/Dockerfile b/comps/llms/text-generation/ollama/langchain/Dockerfile index 13fe6a39e..6ac66d056 100644 --- a/comps/llms/text-generation/ollama/langchain/Dockerfile +++ b/comps/llms/text-generation/ollama/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ curl \ diff --git a/comps/llms/text-generation/tgi/Dockerfile b/comps/llms/text-generation/tgi/Dockerfile index 6797f8603..831d83014 100644 --- a/comps/llms/text-generation/tgi/Dockerfile +++ b/comps/llms/text-generation/tgi/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/llms/text-generation/vllm/langchain/Dockerfile b/comps/llms/text-generation/vllm/langchain/Dockerfile index 2c3d187c3..22d288225 100644 --- a/comps/llms/text-generation/vllm/langchain/Dockerfile +++ b/comps/llms/text-generation/vllm/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" # Set this to "cpu" or "gpu" diff --git a/comps/llms/text-generation/vllm/ray/Dockerfile b/comps/llms/text-generation/vllm/ray/Dockerfile index 40d747379..148a4b01d 100644 --- a/comps/llms/text-generation/vllm/ray/Dockerfile +++ b/comps/llms/text-generation/vllm/ray/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/ragas/tgi/langchain/Dockerfile b/comps/ragas/tgi/langchain/Dockerfile index 3328e8ed1..adec50e58 100644 --- a/comps/ragas/tgi/langchain/Dockerfile +++ b/comps/ragas/tgi/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/reranks/mosec/langchain/Dockerfile b/comps/reranks/mosec/langchain/Dockerfile index 23faf56c6..509c0238b 100644 --- a/comps/reranks/mosec/langchain/Dockerfile +++ b/comps/reranks/mosec/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/retrievers/multimodal/redis/langchain/Dockerfile b/comps/retrievers/multimodal/redis/langchain/Dockerfile index 9423561e1..fa25b2efe 100644 --- a/comps/retrievers/multimodal/redis/langchain/Dockerfile +++ b/comps/retrievers/multimodal/redis/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/retrievers/pathway/langchain/Dockerfile b/comps/retrievers/pathway/langchain/Dockerfile index d14d07861..c8d3b72c4 100644 --- a/comps/retrievers/pathway/langchain/Dockerfile +++ b/comps/retrievers/pathway/langchain/Dockerfile @@ -2,7 +2,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/retrievers/pgvector/langchain/Dockerfile b/comps/retrievers/pgvector/langchain/Dockerfile index c5d460346..b752aaaf8 100644 --- a/comps/retrievers/pgvector/langchain/Dockerfile +++ b/comps/retrievers/pgvector/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ diff --git a/comps/retrievers/pinecone/langchain/Dockerfile b/comps/retrievers/pinecone/langchain/Dockerfile index 5dc83e72c..2d488d3ed 100644 --- a/comps/retrievers/pinecone/langchain/Dockerfile +++ b/comps/retrievers/pinecone/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/retrievers/redis/langchain/Dockerfile b/comps/retrievers/redis/langchain/Dockerfile index 852323d03..6b240a989 100644 --- a/comps/retrievers/redis/langchain/Dockerfile +++ b/comps/retrievers/redis/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/retrievers/vdms/langchain/Dockerfile b/comps/retrievers/vdms/langchain/Dockerfile index a44ea0475..baf1ea731 100644 --- a/comps/retrievers/vdms/langchain/Dockerfile +++ b/comps/retrievers/vdms/langchain/Dockerfile @@ -2,7 +2,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" diff --git a/comps/web_retrievers/chroma/langchain/Dockerfile b/comps/web_retrievers/chroma/langchain/Dockerfile index 149e4d362..614dd6c9b 100644 --- a/comps/web_retrievers/chroma/langchain/Dockerfile +++ b/comps/web_retrievers/chroma/langchain/Dockerfile @@ -1,7 +1,7 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -FROM langchain/langchain:latest +FROM python:3.11-slim ARG ARCH="cpu" # Set this to "cpu" or "gpu" diff --git a/tests/llms/test_llms_text-generation_tgi.sh b/tests/llms/test_llms_text-generation_tgi.sh index 293bbb292..db01b60e2 100644 --- a/tests/llms/test_llms_text-generation_tgi.sh +++ b/tests/llms/test_llms_text-generation_tgi.sh @@ -21,10 +21,10 @@ function build_docker_images() { function start_service() { tgi_endpoint_port=5004 - export your_hf_llm_model=$1 + export hf_llm_model=$1 # Remember to set HF_TOKEN before invoking this test! export HF_TOKEN=${HF_TOKEN} - docker run -d --name="test-comps-llm-tgi-endpoint" -p $tgi_endpoint_port:80 -v ./data:/data --shm-size 1g -e HF_TOKEN=${HF_TOKEN} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id ${your_hf_llm_model} --max-input-tokens 1024 --max-total-tokens 2048 + docker run -d --name="test-comps-llm-tgi-endpoint" -p $tgi_endpoint_port:80 -v ~/.cache/huggingface/hub:/data --shm-size 1g -e HF_TOKEN=${HF_TOKEN} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id ${hf_llm_model} --max-input-tokens 1024 --max-total-tokens 2048 export TGI_LLM_ENDPOINT="http://${ip_address}:${tgi_endpoint_port}" llm_port=5005 @@ -34,9 +34,9 @@ function start_service() { # check whether tgi is fully ready n=0 until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do - docker logs test-comps-llm-tgi-endpoint >> ${LOG_PATH}/llm-tgi.log + docker logs test-comps-llm-tgi-endpoint >> ${LOG_PATH}/${hf_llm_model}-llm-tgi.log n=$((n+1)) - if grep -q Connected ${LOG_PATH}/llm-tgi.log; then + if grep -q Connected ${LOG_PATH}/${hf_llm_model}-llm-tgi.log; then break fi sleep 5s diff --git a/tests/retrievers/test_retrievers_pinecone_langchain.sh b/tests/retrievers/test_retrievers_pinecone_langchain.sh index 4077f4f39..643523b7d 100644 --- a/tests/retrievers/test_retrievers_pinecone_langchain.sh +++ b/tests/retrievers/test_retrievers_pinecone_langchain.sh @@ -33,7 +33,7 @@ function start_service() { export HUGGINGFACEHUB_API_TOKEN=$HF_TOKEN retriever_port=5054 unset http_proxy - docker run -d --name="test-comps-retriever-pinecone-server" -p ${retriever_port}:7000 --ipc=host -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e PINECONE_API_KEY=$PINECONE_API_KEY -e PINECONE_INDEX_NAME=$PINECONE_INDEX_NAME -e INDEX_NAME=$PINECONE_INDEX_NAME opea/retriever-pinecone:comps + docker run -d --name="test-comps-retriever-pinecone-server" -p ${retriever_port}:7000 --ipc=host -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e PINECONE_API_KEY=$PINECONE_API_KEY -e PINECONE_INDEX_NAME=$PINECONE_INDEX_NAME -e INDEX_NAME=$PINECONE_INDEX_NAME opea/retriever-pinecone:comps sleep 2m } diff --git a/tests/retrievers/test_retrievers_redis_langchain.sh b/tests/retrievers/test_retrievers_redis_langchain.sh index 773be81e6..dd34a2a0f 100644 --- a/tests/retrievers/test_retrievers_redis_langchain.sh +++ b/tests/retrievers/test_retrievers_redis_langchain.sh @@ -34,9 +34,10 @@ function start_service() { # redis retriever export REDIS_URL="redis://${ip_address}:5010" export INDEX_NAME="rag-redis" + export HUGGINGFACEHUB_API_TOKEN=$HF_TOKEN retriever_port=5435 # unset http_proxy - docker run -d --name="test-comps-retriever-redis-server" -p ${retriever_port}:7000 --ipc=host -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e REDIS_URL=$REDIS_URL -e INDEX_NAME=$INDEX_NAME opea/retriever-redis:comps + docker run -d --name="test-comps-retriever-redis-server" -p ${retriever_port}:7000 --ipc=host -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e REDIS_URL=$REDIS_URL -e INDEX_NAME=$INDEX_NAME opea/retriever-redis:comps sleep 3m }