From 6c1266fa3d77442397a0be1080291b8244999025 Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Mon, 23 Dec 2024 20:47:19 +0800 Subject: [PATCH 01/11] Fix text2sql path due to the refactoring of Comps. Signed-off-by: Yao, Qing --- DBQnA/docker_compose/intel/cpu/xeon/README.md | 2 +- DBQnA/tests/test_compose_on_xeon.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DBQnA/docker_compose/intel/cpu/xeon/README.md b/DBQnA/docker_compose/intel/cpu/xeon/README.md index baa90e69e6..4d2781d517 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/README.md +++ b/DBQnA/docker_compose/intel/cpu/xeon/README.md @@ -11,7 +11,7 @@ First of all, you need to build Docker Images locally. This step can be ignored ```bash git clone https://github.com/opea-project/GenAIComps.git cd GenAIComps -docker build --no-cache -t opea/texttosql:comps -f comps/texttosql/langchain/Dockerfile . +docker build --no-cache -t opea/texttosql:comps -f comps/texttosql/src/Dockerfile . ``` diff --git a/DBQnA/tests/test_compose_on_xeon.sh b/DBQnA/tests/test_compose_on_xeon.sh index 9d6bf079e5..f0a9a11a0e 100755 --- a/DBQnA/tests/test_compose_on_xeon.sh +++ b/DBQnA/tests/test_compose_on_xeon.sh @@ -28,7 +28,7 @@ function build_docker_images() { rm -rf GenAIComps/ git clone https://github.com/opea-project/GenAIComps.git cd $OPEAPATH/GenAIComps - docker build --no-cache -t opea/texttosql:latest -f comps/texttosql/langchain/Dockerfile . + docker build --no-cache -t opea/texttosql:latest -f comps/texttosql/src/Dockerfile . echo "Building React UI service..." cd $OPEAPATH/GenAIExamples/DBQnA/ui From 519b8000b21bb69b13ca202f14ff4300416324e4 Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 10:04:31 +0800 Subject: [PATCH 02/11] Rename texttosql text2sql. Signed-off-by: Yao, Qing --- DBQnA/docker_compose/intel/cpu/xeon/README.md | 16 ++++++++-------- .../docker_compose/intel/cpu/xeon/compose.yaml | 8 ++++---- DBQnA/docker_image_build/build.yaml | 10 +++++----- DBQnA/tests/test_compose_on_xeon.sh | 18 +++++++++--------- DBQnA/ui/react/src/App.test.tsx | 2 +- .../src/components/DbConnect/DBConnect.tsx | 4 ++-- .../components/DbConnect/dbconnect.module.scss | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DBQnA/docker_compose/intel/cpu/xeon/README.md b/DBQnA/docker_compose/intel/cpu/xeon/README.md index 4d2781d517..78d5b60419 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/README.md +++ b/DBQnA/docker_compose/intel/cpu/xeon/README.md @@ -11,7 +11,7 @@ First of all, you need to build Docker Images locally. This step can be ignored ```bash git clone https://github.com/opea-project/GenAIComps.git cd GenAIComps -docker build --no-cache -t opea/texttosql:comps -f comps/texttosql/src/Dockerfile . +docker build --no-cache -t opea/text2sql:comps -f comps/text2sql/src/Dockerfile . ``` @@ -21,13 +21,13 @@ Build the frontend Docker image based on react framework via below command: ```bash cd GenAIExamples/DBQnA/ui -docker build --no-cache -t opea/texttosql-react-ui:latest -f docker/Dockerfile.react . +docker build --no-cache -t opea/text2sql-react-ui:latest -f docker/Dockerfile.react . ``` Then run the command `docker images`, you will have the following Docker Images: -1. `opea/texttosql:latest` +1. `opea/text2sql:latest` 2. `opea/dbqna-react-ui:latest` ## 🚀 Start Microservices @@ -62,7 +62,7 @@ export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3" export POSTGRES_USER=postgres export POSTGRES_PASSWORD=testpwd export POSTGRES_DB=chinook -export texttosql_port=9090 +export text2sql_port=9090 ``` Note: Please replace with `your_ip` with your external IP address, do not use localhost. @@ -90,14 +90,14 @@ We will use [Chinook](https://github.com/lerocha/chinook-database) sample databa ```bash -docker run --name test-texttosql-postgres --ipc=host -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -p 5442:5432 -d -v $WORKPATH/comps/texttosql/langchain/chinook.sql:/docker-entrypoint-initdb.d/chinook.sql postgres:latest +docker run --name test-text2sql-postgres --ipc=host -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -p 5442:5432 -d -v $WORKPATH/comps/text2sql/langchain/chinook.sql:/docker-entrypoint-initdb.d/chinook.sql postgres:latest ``` - Start TGI Service ```bash -docker run -d --name="test-texttosql-tgi-endpoint" --ipc=host -p $TGI_PORT:80 -v ./data:/data --shm-size 1g -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HF_TOKEN} -e model=${model} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id $model +docker run -d --name="test-text2sql-tgi-endpoint" --ipc=host -p $TGI_PORT:80 -v ./data:/data --shm-size 1g -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HF_TOKEN} -e model=${model} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id $model ``` - Start Text-to-SQL Service @@ -105,7 +105,7 @@ docker run -d --name="test-texttosql-tgi-endpoint" --ipc=host -p $TGI_PORT:80 -v ```bash unset http_proxy -docker run -d --name="test-texttosql-server" --ipc=host -p ${texttosql_port}:8090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT opea/texttosql:latest +docker run -d --name="test-text2sql-server" --ipc=host -p ${text2sql_port}:8090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT opea/text2sql:latest ``` - Start React UI service @@ -141,7 +141,7 @@ curl --location http://${your_ip}:9090/v1/postgres/health \ #### 3.2.2 Invoke the microservice. ```bash -curl http://${your_ip}:9090/v1/texttosql\ +curl http://${your_ip}:9090/v1/text2sql\ -X POST \ -d '{"input_text": "Find the total number of Albums.","conn_str": {"user": "'${POSTGRES_USER}'","password": "'${POSTGRES_PASSWORD}'","host": "'${your_ip}'", "port": "5442", "database": "'${POSTGRES_DB}'"}}' \ -H 'Content-Type: application/json' diff --git a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml index 6f946d535c..47e02395e7 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml +++ b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml @@ -32,9 +32,9 @@ services: volumes: - ./chinook.sql:/docker-entrypoint-initdb.d/chinook.sql - texttosql-service: - image: opea/texttosql:latest - container_name: texttosql-service + text2sql-service: + image: opea/text2sql:latest + container_name: text2sql-service ports: - "9090:8090" environment: @@ -44,7 +44,7 @@ services: image: opea/dbqna-react-ui:latest container_name: dbqna-xeon-react-ui-server depends_on: - - texttosql-service + - text2sql-service ports: - "5174:80" environment: diff --git a/DBQnA/docker_image_build/build.yaml b/DBQnA/docker_image_build/build.yaml index 9c92955b47..cb24cc58ad 100644 --- a/DBQnA/docker_image_build/build.yaml +++ b/DBQnA/docker_image_build/build.yaml @@ -2,16 +2,16 @@ # SPDX-License-Identifier: Apache-2.0 services: - texttosql: + text2sql: build: context: GenAIComps - dockerfile: comps/texttosql/langchain/Dockerfile + dockerfile: comps/text2sql/src/Dockerfile args: http_proxy: ${http_proxy} https_proxy: ${https_proxy} no_proxy: ${no_proxy} - image: ${REGISTRY:-opea}/texttosql:${TAG:-latest} - texttosql-react-ui: + image: ${REGISTRY:-opea}/text2sql:${TAG:-latest} + text2sql-react-ui: build: context: ../ui dockerfile: ./docker/Dockerfile.react @@ -19,4 +19,4 @@ services: http_proxy: ${http_proxy} https_proxy: ${https_proxy} no_proxy: ${no_proxy} - image: ${REGISTRY:-opea}/texttosql-react-ui:${TAG:-latest} + image: ${REGISTRY:-opea}/text2sql-react-ui:${TAG:-latest} diff --git a/DBQnA/tests/test_compose_on_xeon.sh b/DBQnA/tests/test_compose_on_xeon.sh index f0a9a11a0e..fff5eac4e5 100755 --- a/DBQnA/tests/test_compose_on_xeon.sh +++ b/DBQnA/tests/test_compose_on_xeon.sh @@ -15,7 +15,7 @@ export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export POSTGRES_USER=postgres export POSTGRES_PASSWORD=testpwd export POSTGRES_DB=chinook -export TEXTTOSQL_PORT=9090 +export TEXT2SQL_PORT=9090 export TGI_LLM_ENDPOINT="http://${ip_address}:${tgi_port}" @@ -28,7 +28,7 @@ function build_docker_images() { rm -rf GenAIComps/ git clone https://github.com/opea-project/GenAIComps.git cd $OPEAPATH/GenAIComps - docker build --no-cache -t opea/texttosql:latest -f comps/texttosql/src/Dockerfile . + docker build --no-cache -t opea/text2sql:latest -f comps/text2sql/src/Dockerfile . echo "Building React UI service..." cd $OPEAPATH/GenAIExamples/DBQnA/ui @@ -38,17 +38,17 @@ function build_docker_images() { function start_service() { - docker run --name test-texttosql-postgres --ipc=host -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -p 5442:5432 -d -v $WORKPATH/docker_compose/intel/cpu/xeon/chinook.sql:/docker-entrypoint-initdb.d/chinook.sql postgres:latest + docker run --name test-text2sql-postgres --ipc=host -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -p 5442:5432 -d -v $WORKPATH/docker_compose/intel/cpu/xeon/chinook.sql:/docker-entrypoint-initdb.d/chinook.sql postgres:latest - docker run -d --name="test-texttosql-tgi-endpoint" --ipc=host -p $tgi_port:80 -v ./data:/data --shm-size 1g -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e model=${model} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id $model + docker run -d --name="test-text2sql-tgi-endpoint" --ipc=host -p $tgi_port:80 -v ./data:/data --shm-size 1g -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e model=${model} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id $model - docker run -d --name="test-texttosql-server" --ipc=host -p $TEXTTOSQL_PORT:8090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT opea/texttosql:latest + docker run -d --name="test-text2sql-server" --ipc=host -p $TEXT2SQL_PORT:8090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT opea/text2sql:latest # check whether tgi is fully ready. n=0 until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do - docker logs test-texttosql-tgi-endpoint > ${LOG_PATH}/tgi.log + docker logs test-text2sql-tgi-endpoint > ${LOG_PATH}/tgi.log n=$((n+1)) if grep -q Connected ${LOG_PATH}/tgi.log; then break @@ -63,7 +63,7 @@ function start_service() { } function validate_microservice() { - result=$(http_proxy="" curl --connect-timeout 5 --max-time 120000 http://${ip_address}:$TEXTTOSQL_PORT/v1/texttosql\ + result=$(http_proxy="" curl --connect-timeout 5 --max-time 120000 http://${ip_address}:$TEXT2SQL_PORT/v1/text2sql\ -X POST \ -d '{"input_text": "Find the total number of Albums.","conn_str": {"user": "'${POSTGRES_USER}'","password": "'${POSTGRES_PASSWORD}'","host": "'${ip_address}'", "port": "5442", "database": "'${POSTGRES_DB}'" }}' \ -H 'Content-Type: application/json') @@ -73,8 +73,8 @@ function validate_microservice() { echo "Result correct." else echo "Result wrong. Received was $result" - docker logs test-texttosql-server > ${LOG_PATH}/texttosql.log - docker logs test-texttosql-tgi-endpoint > ${LOG_PATH}/tgi.log + docker logs test-text2sql-server > ${LOG_PATH}/text2sql.log + docker logs test-text2sql-tgi-endpoint > ${LOG_PATH}/tgi.log exit 1 fi diff --git a/DBQnA/ui/react/src/App.test.tsx b/DBQnA/ui/react/src/App.test.tsx index a2f005d777..61c6e309d1 100644 --- a/DBQnA/ui/react/src/App.test.tsx +++ b/DBQnA/ui/react/src/App.test.tsx @@ -21,7 +21,7 @@ const getHostIP = () => { test('testing api with dynamic host', async () => { // Get the dynamic host IP const host = await getHostIP(); - const endpointUrl = `http://${host}:9090/v1/texttosql`; + const endpointUrl = `http://${host}:9090/v1/text2sql`; const formData = { user: 'postgres', diff --git a/DBQnA/ui/react/src/components/DbConnect/DBConnect.tsx b/DBQnA/ui/react/src/components/DbConnect/DBConnect.tsx index 860749c237..9968bcf354 100644 --- a/DBQnA/ui/react/src/components/DbConnect/DBConnect.tsx +++ b/DBQnA/ui/react/src/components/DbConnect/DBConnect.tsx @@ -79,7 +79,7 @@ const DBConnect: React.FC = () => { }; let api_response: Record; - api_response = await axios.post(`${TEXT_TO_SQL_URL}/texttosql`, payload); + api_response = await axios.post(`${TEXT_TO_SQL_URL}/text2sql`, payload); setSqlQuery(api_response.data.result.sql); // Assuming the API returns an SQL query setQueryOutput(api_response.data.result.output); @@ -163,7 +163,7 @@ const DBConnect: React.FC = () => { {/* DBQnA Section */} -
+
DBQnA {isConnected && (
diff --git a/DBQnA/ui/react/src/components/DbConnect/dbconnect.module.scss b/DBQnA/ui/react/src/components/DbConnect/dbconnect.module.scss index fff4f127a4..7df40e22f0 100644 --- a/DBQnA/ui/react/src/components/DbConnect/dbconnect.module.scss +++ b/DBQnA/ui/react/src/components/DbConnect/dbconnect.module.scss @@ -19,7 +19,7 @@ } .dbConnectSection, - .textToSQLSection { + .text2SQLSection { flex: 1; /* Allow each section to take up equal space */ padding: 20px; background-color: white; From 8393addb046026657cd60f4f561b0c355516704c Mon Sep 17 00:00:00 2001 From: chensuyue Date: Fri, 27 Dec 2024 10:26:47 +0800 Subject: [PATCH 03/11] for test only, need to revert before merge Signed-off-by: chensuyue --- .github/workflows/_run-docker-compose.yml | 1 + .github/workflows/pr-docker-compose-e2e.yml | 2 +- .github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_run-docker-compose.yml b/.github/workflows/_run-docker-compose.yml index daf87add83..68930ba3ea 100644 --- a/.github/workflows/_run-docker-compose.yml +++ b/.github/workflows/_run-docker-compose.yml @@ -134,6 +134,7 @@ jobs: SERVING_TOKEN: ${{ secrets.SERVING_TOKEN }} IMAGE_REPO: ${{ inputs.registry }} IMAGE_TAG: ${{ inputs.tag }} + opea_branch: "yao531441/text2sql" example: ${{ inputs.example }} hardware: ${{ inputs.hardware }} test_case: ${{ matrix.test_case }} diff --git a/.github/workflows/pr-docker-compose-e2e.yml b/.github/workflows/pr-docker-compose-e2e.yml index 687ae047a3..c52677f31e 100644 --- a/.github/workflows/pr-docker-compose-e2e.yml +++ b/.github/workflows/pr-docker-compose-e2e.yml @@ -4,7 +4,7 @@ name: E2E test with docker compose on: - pull_request_target: + pull_request: branches: ["main", "*rc"] types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped paths: diff --git a/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml b/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml index ededdba43c..20db01f21a 100644 --- a/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml +++ b/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml @@ -22,6 +22,7 @@ jobs: run: | cd .. git clone https://github.com/opea-project/GenAIComps.git + cd GenAIComps && git checkout yao531441/text2sql - name: Check for Missing Dockerfile Paths in GenAIComps run: | From 5e9298a46025c6739093c0fa2d1fa2abdf2fb43f Mon Sep 17 00:00:00 2001 From: chensuyue Date: Fri, 27 Dec 2024 12:18:02 +0800 Subject: [PATCH 04/11] refine test Signed-off-by: chensuyue --- .../intel/cpu/xeon/compose.yaml | 4 +- DBQnA/tests/test_compose_on_xeon.sh | 65 ++++++++----------- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml index 47e02395e7..9223b5987d 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml +++ b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml @@ -33,7 +33,7 @@ services: - ./chinook.sql:/docker-entrypoint-initdb.d/chinook.sql text2sql-service: - image: opea/text2sql:latest + image: ${REGISTRY:-opea}/text2sql:${TAG:-latest} container_name: text2sql-service ports: - "9090:8090" @@ -41,7 +41,7 @@ services: - TGI_LLM_ENDPOINT=${TGI_LLM_ENDPOINT} dbqna-xeon-react-ui-server: - image: opea/dbqna-react-ui:latest + image: ${REGISTRY:-opea}/dbqna-react-ui:${TAG:-latest} container_name: dbqna-xeon-react-ui-server depends_on: - text2sql-service diff --git a/DBQnA/tests/test_compose_on_xeon.sh b/DBQnA/tests/test_compose_on_xeon.sh index fff5eac4e5..5f290d15c9 100755 --- a/DBQnA/tests/test_compose_on_xeon.sh +++ b/DBQnA/tests/test_compose_on_xeon.sh @@ -4,46 +4,38 @@ set -xe +IMAGE_REPO=${IMAGE_REPO:-"opea"} +IMAGE_TAG=${IMAGE_TAG:-"latest"} +echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" +echo "TAG=IMAGE_TAG=${IMAGE_TAG}" +export REGISTRY=${IMAGE_REPO} +export TAG=${IMAGE_TAG} + WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') tgi_port=8008 -tgi_volume=$WORKPATH/data - -export model="meta-llama/Meta-Llama-3-8B-Instruct" -export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -export POSTGRES_USER=postgres -export POSTGRES_PASSWORD=testpwd -export POSTGRES_DB=chinook -export TEXT2SQL_PORT=9090 -export TGI_LLM_ENDPOINT="http://${ip_address}:${tgi_port}" - function build_docker_images() { - echo $WORKPATH - OPEAPATH=$(realpath "$WORKPATH/../..") - - echo "Building Text to Sql service..." - cd $OPEAPATH - rm -rf GenAIComps/ - git clone https://github.com/opea-project/GenAIComps.git - cd $OPEAPATH/GenAIComps - docker build --no-cache -t opea/text2sql:latest -f comps/text2sql/src/Dockerfile . - - echo "Building React UI service..." - cd $OPEAPATH/GenAIExamples/DBQnA/ui - docker build --no-cache -t opea/dbqna-react-ui:latest -f docker/Dockerfile.react . + cd $WORKPATH/docker_image_build + git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../ + echo "Build all the images with --no-cache, check docker_image_build.log for details..." + docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log } function start_service() { - - docker run --name test-text2sql-postgres --ipc=host -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -p 5442:5432 -d -v $WORKPATH/docker_compose/intel/cpu/xeon/chinook.sql:/docker-entrypoint-initdb.d/chinook.sql postgres:latest - - docker run -d --name="test-text2sql-tgi-endpoint" --ipc=host -p $tgi_port:80 -v ./data:/data --shm-size 1g -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e model=${model} ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id $model - - - docker run -d --name="test-text2sql-server" --ipc=host -p $TEXT2SQL_PORT:8090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT opea/text2sql:latest + cd $WORKPATH/docker_compose/intel/cpu/xeon + export model="meta-llama/Meta-Llama-3-8B-Instruct" + export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} + export POSTGRES_USER=postgres + export POSTGRES_PASSWORD=testpwd + export POSTGRES_DB=chinook + export TEXT2SQL_PORT=9090 + export TGI_LLM_ENDPOINT="http://${ip_address}:${tgi_port}" + + # Start Docker Containers + docker compose -f compose.yaml up -d > ${LOG_PATH}/start_services_with_compose.log # check whether tgi is fully ready. n=0 @@ -55,11 +47,6 @@ function start_service() { fi sleep 5s done - sleep 5s - - # Run the UI container - docker run -d --name="test-dbqna-react-ui-server" --ipc=host -p 5174:80 -e no_proxy=$no_proxy -e https_proxy=$https_proxy -e http_proxy=$http_proxy opea/dbqna-react-ui:latest - } function validate_microservice() { @@ -73,8 +60,8 @@ function validate_microservice() { echo "Result correct." else echo "Result wrong. Received was $result" - docker logs test-text2sql-server > ${LOG_PATH}/text2sql.log - docker logs test-text2sql-tgi-endpoint > ${LOG_PATH}/tgi.log + docker logs text2sql-service > ${LOG_PATH}/text2sql.log + docker logs tgi-service > ${LOG_PATH}/tgi.log exit 1 fi @@ -110,8 +97,8 @@ function validate_frontend() { } function stop_docker() { - cid=$(docker ps -aq --filter "name=test-*") - if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi + cd $WORKPATH/docker_compose/intel/cpu/xeon + docker compose stop && docker compose rm -f } function main() { From 4c539b4867d0908c4cf0b2b1ba9a1a994b691d8f Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 12:27:34 +0800 Subject: [PATCH 05/11] Fix text2sql ui image name. Signed-off-by: Yao, Qing --- DBQnA/docker_compose/intel/cpu/xeon/compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml index 9223b5987d..a65e864105 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml +++ b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml @@ -41,7 +41,7 @@ services: - TGI_LLM_ENDPOINT=${TGI_LLM_ENDPOINT} dbqna-xeon-react-ui-server: - image: ${REGISTRY:-opea}/dbqna-react-ui:${TAG:-latest} + image: ${REGISTRY:-opea}/text2sql-react-ui:${TAG:-latest} container_name: dbqna-xeon-react-ui-server depends_on: - text2sql-service From 5b5f1ffa2841a476f9eb5a416f194f965d00b42b Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 13:30:51 +0800 Subject: [PATCH 06/11] Fix text2sql UT container name. Signed-off-by: Yao, Qing --- DBQnA/tests/test_compose_on_xeon.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DBQnA/tests/test_compose_on_xeon.sh b/DBQnA/tests/test_compose_on_xeon.sh index 5f290d15c9..fa830939c3 100755 --- a/DBQnA/tests/test_compose_on_xeon.sh +++ b/DBQnA/tests/test_compose_on_xeon.sh @@ -40,7 +40,7 @@ function start_service() { # check whether tgi is fully ready. n=0 until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do - docker logs test-text2sql-tgi-endpoint > ${LOG_PATH}/tgi.log + docker logs tgi-service > ${LOG_PATH}/tgi.log n=$((n+1)) if grep -q Connected ${LOG_PATH}/tgi.log; then break From 4c80b8d2b59743e3db24f6cc0c727e01c2de5c95 Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 13:48:55 +0800 Subject: [PATCH 07/11] Fix for text2sql UT . Signed-off-by: Yao, Qing --- DBQnA/docker_compose/intel/cpu/xeon/compose.yaml | 2 +- DBQnA/tests/test_compose_on_xeon.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml index a65e864105..cf4127cff6 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml +++ b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml @@ -36,7 +36,7 @@ services: image: ${REGISTRY:-opea}/text2sql:${TAG:-latest} container_name: text2sql-service ports: - - "9090:8090" + - "9090:8080" environment: - TGI_LLM_ENDPOINT=${TGI_LLM_ENDPOINT} diff --git a/DBQnA/tests/test_compose_on_xeon.sh b/DBQnA/tests/test_compose_on_xeon.sh index fa830939c3..f2a33e1b57 100755 --- a/DBQnA/tests/test_compose_on_xeon.sh +++ b/DBQnA/tests/test_compose_on_xeon.sh @@ -27,6 +27,7 @@ function build_docker_images() { function start_service() { cd $WORKPATH/docker_compose/intel/cpu/xeon export model="meta-llama/Meta-Llama-3-8B-Instruct" + export LLM_MODEL_ID=${model} export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export POSTGRES_USER=postgres export POSTGRES_PASSWORD=testpwd From 9813f31fcd96278028ebd45225d10e0963401f75 Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 14:18:14 +0800 Subject: [PATCH 08/11] Fix for text2sql UT . Signed-off-by: Yao, Qing --- DBQnA/tests/test_compose_on_xeon.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DBQnA/tests/test_compose_on_xeon.sh b/DBQnA/tests/test_compose_on_xeon.sh index f2a33e1b57..071773920a 100755 --- a/DBQnA/tests/test_compose_on_xeon.sh +++ b/DBQnA/tests/test_compose_on_xeon.sh @@ -26,7 +26,7 @@ function build_docker_images() { function start_service() { cd $WORKPATH/docker_compose/intel/cpu/xeon - export model="meta-llama/Meta-Llama-3-8B-Instruct" + export model="mistralai/Mistral-7B-Instruct-v0.3" export LLM_MODEL_ID=${model} export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export POSTGRES_USER=postgres From c2433f971c868732e309c2c75034e6ffe9824f28 Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 14:39:32 +0800 Subject: [PATCH 09/11] Fix for text2sql UT . Signed-off-by: Yao, Qing --- DBQnA/docker_compose/intel/cpu/xeon/compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml index cf4127cff6..9b2bcbfbaa 100644 --- a/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml +++ b/DBQnA/docker_compose/intel/cpu/xeon/compose.yaml @@ -15,7 +15,8 @@ services: no_proxy: ${no_proxy} http_proxy: ${http_proxy} https_proxy: ${https_proxy} - HF_TOKEN: ${HF_TOKEN} + HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN} + HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN} shm_size: 1g command: --model-id ${LLM_MODEL_ID} From d213c9d11e6cbb8f23845325462fbf00bac917c3 Mon Sep 17 00:00:00 2001 From: "Yao, Qing" Date: Fri, 27 Dec 2024 15:35:49 +0800 Subject: [PATCH 10/11] Fix for text2sql UT . Signed-off-by: Yao, Qing --- DBQnA/ui/react/src/App.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DBQnA/ui/react/src/App.test.tsx b/DBQnA/ui/react/src/App.test.tsx index 61c6e309d1..27cddeebf6 100644 --- a/DBQnA/ui/react/src/App.test.tsx +++ b/DBQnA/ui/react/src/App.test.tsx @@ -43,9 +43,10 @@ test('testing api with dynamic host', async () => { expect(response.status).toBe(200); const result = response.data.result; + console.log(result); expect(result.hasOwnProperty('sql')).toBe(true); expect(result.hasOwnProperty('output')).toBe(true); expect(result.hasOwnProperty('input')).toBe(true); - expect(result.input).toBe(question); + expect(result.input.input_text).toBe(question); }, apiTimeOutInSeconds * 1000); From 197eff4118195f1c7b8dc0fc2e2ac45f37d9d8d1 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Thu, 2 Jan 2025 10:10:10 +0800 Subject: [PATCH 11/11] Revert "for test only, need to revert before merge" This reverts commit 8393addb046026657cd60f4f561b0c355516704c. --- .github/workflows/_run-docker-compose.yml | 1 - .github/workflows/pr-docker-compose-e2e.yml | 2 +- .github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/_run-docker-compose.yml b/.github/workflows/_run-docker-compose.yml index 68930ba3ea..daf87add83 100644 --- a/.github/workflows/_run-docker-compose.yml +++ b/.github/workflows/_run-docker-compose.yml @@ -134,7 +134,6 @@ jobs: SERVING_TOKEN: ${{ secrets.SERVING_TOKEN }} IMAGE_REPO: ${{ inputs.registry }} IMAGE_TAG: ${{ inputs.tag }} - opea_branch: "yao531441/text2sql" example: ${{ inputs.example }} hardware: ${{ inputs.hardware }} test_case: ${{ matrix.test_case }} diff --git a/.github/workflows/pr-docker-compose-e2e.yml b/.github/workflows/pr-docker-compose-e2e.yml index c52677f31e..687ae047a3 100644 --- a/.github/workflows/pr-docker-compose-e2e.yml +++ b/.github/workflows/pr-docker-compose-e2e.yml @@ -4,7 +4,7 @@ name: E2E test with docker compose on: - pull_request: + pull_request_target: branches: ["main", "*rc"] types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped paths: diff --git a/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml b/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml index 20db01f21a..ededdba43c 100644 --- a/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml +++ b/.github/workflows/pr-dockerfile-path-and-build-yaml-scan.yml @@ -22,7 +22,6 @@ jobs: run: | cd .. git clone https://github.com/opea-project/GenAIComps.git - cd GenAIComps && git checkout yao531441/text2sql - name: Check for Missing Dockerfile Paths in GenAIComps run: |