From f4b029805a310ce5bd4b0f03a9439ede149cb3ab Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Wed, 10 Jul 2024 00:08:11 +0800 Subject: [PATCH] fix requirements (#284) Signed-off-by: chensuyue --- .../scripts/docker_images_build_push.sh | 2 +- comps/llms/text-generation/tgi/requirements.txt | 2 ++ comps/reranks/requirements.txt | 2 ++ comps/retrievers/llamaindex/requirements.txt | 3 +++ ...reranks_langchain.sh => test_reranks_tei.sh} | 17 ++++++++++++----- 5 files changed, 20 insertions(+), 6 deletions(-) rename tests/{test_reranks_langchain.sh => test_reranks_tei.sh} (78%) diff --git a/.github/workflows/scripts/docker_images_build_push.sh b/.github/workflows/scripts/docker_images_build_push.sh index ff8a6b8f4..d37be3bde 100644 --- a/.github/workflows/scripts/docker_images_build_push.sh +++ b/.github/workflows/scripts/docker_images_build_push.sh @@ -39,7 +39,7 @@ case ${micro_service} in "retrievers/langchain") IMAGE_NAME="opea/retriever-redis" ;; - "reranks/langchain") + "reranks/tei") IMAGE_NAME="opea/reranking-tei" ;; "llms/text-generation/tgi") diff --git a/comps/llms/text-generation/tgi/requirements.txt b/comps/llms/text-generation/tgi/requirements.txt index e87736e7f..621b52cc0 100644 --- a/comps/llms/text-generation/tgi/requirements.txt +++ b/comps/llms/text-generation/tgi/requirements.txt @@ -1,5 +1,7 @@ +aiohttp docarray[full] fastapi +httpx huggingface_hub langsmith opentelemetry-api diff --git a/comps/reranks/requirements.txt b/comps/reranks/requirements.txt index 638625d99..36e38e89e 100644 --- a/comps/reranks/requirements.txt +++ b/comps/reranks/requirements.txt @@ -1,5 +1,7 @@ +aiohttp docarray[full] fastapi +httpx langsmith opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/retrievers/llamaindex/requirements.txt b/comps/retrievers/llamaindex/requirements.txt index c73476e4d..d6bc736e3 100644 --- a/comps/retrievers/llamaindex/requirements.txt +++ b/comps/retrievers/llamaindex/requirements.txt @@ -1,6 +1,8 @@ +aiohttp docarray[full] easyocr fastapi +httpx langsmith llama-index-vector-stores-redis llama_index @@ -11,3 +13,4 @@ pymupdf redis sentence_transformers shortuuid + diff --git a/tests/test_reranks_langchain.sh b/tests/test_reranks_tei.sh similarity index 78% rename from tests/test_reranks_langchain.sh rename to tests/test_reranks_tei.sh index 1a3751927..0777e7e4d 100644 --- a/tests/test_reranks_langchain.sh +++ b/tests/test_reranks_tei.sh @@ -8,7 +8,7 @@ WORKPATH=$(dirname "$PWD") ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH - docker build --no-cache -t opea/reranking-tei:comps -f comps/reranks/langchain/docker/Dockerfile . + docker build --no-cache -t opea/reranking-tei:comps -f comps/reranks/tei/docker/Dockerfile . } function start_service() { @@ -29,12 +29,19 @@ function start_service() { function validate_microservice() { tei_service_port=5007 - http_proxy="" curl http://${ip_address}:${tei_service_port}/v1/reranking\ + local CONTENT=$(curl http://${ip_address}:${tei_service_port}/v1/reranking \ -X POST \ -d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \ - -H 'Content-Type: application/json' - docker logs test-comps-reranking-tei-server - docker logs test-comps-reranking-tei-endpoint + -H 'Content-Type: application/json') + + if echo "$CONTENT" | grep -q "### Search results:"; then + echo "Content is as expected." + else + echo "Content does not match the expected result: $CONTENT" + docker logs test-comps-reranking-tei-server + docker logs test-comps-reranking-tei-endpoint + exit 1 + fi } function stop_docker() {