Merge FaqGen into ChatQnA (#1654)
1. Delete FaqGen 2. Refactor FaqGen into ChatQnA, serve as a LLM selection. 3. Combine all ChatQnA related Dockerfile into one Signed-off-by: Xinyao Wang <xinyao.wang@intel.com>
This commit is contained in:
@@ -105,7 +105,15 @@ docker build --no-cache -t opea/retriever:latest --build-arg https_proxy=$https_
|
||||
docker build --no-cache -t opea/dataprep:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/src/Dockerfile .
|
||||
```
|
||||
|
||||
### 4. Build MegaService Docker Image
|
||||
### 4. Build FaqGen LLM Image (Optional)
|
||||
|
||||
If you want to enable FAQ generation LLM in the pipeline, please use the below command:
|
||||
|
||||
```bash
|
||||
docker build -t opea/llm-faqgen:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/src/faq-generation/Dockerfile .
|
||||
```
|
||||
|
||||
### 5. Build MegaService Docker Image
|
||||
|
||||
To construct the Mega Service, we utilize the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline within the `chatqna.py` Python script. Build the MegaService Docker image using the command below:
|
||||
|
||||
@@ -116,7 +124,7 @@ docker build --no-cache -t opea/chatqna:latest --build-arg https_proxy=$https_pr
|
||||
cd ../../..
|
||||
```
|
||||
|
||||
### 5. Build UI Docker Image
|
||||
### 6. Build UI Docker Image
|
||||
|
||||
Construct the frontend Docker image using the command below:
|
||||
|
||||
@@ -126,7 +134,7 @@ docker build --no-cache -t opea/chatqna-ui:latest --build-arg https_proxy=$https
|
||||
cd ../../../..
|
||||
```
|
||||
|
||||
### 6. Build React UI Docker Image (Optional)
|
||||
### 7. Build React UI Docker Image (Optional)
|
||||
|
||||
Construct the frontend Docker image using the command below:
|
||||
|
||||
@@ -136,7 +144,7 @@ docker build --no-cache -t opea/chatqna-react-ui:latest --build-arg https_proxy=
|
||||
cd ../../../..
|
||||
```
|
||||
|
||||
### 7. Build Nginx Docker Image
|
||||
### 8. Build Nginx Docker Image
|
||||
|
||||
```bash
|
||||
cd GenAIComps
|
||||
@@ -151,6 +159,10 @@ Then run the command `docker images`, you will have the following 5 Docker Image
|
||||
4. `opea/chatqna-ui:latest` or `opea/chatqna-react-ui:latest`
|
||||
5. `opea/nginx:latest`
|
||||
|
||||
If FaqGen docker image is built, you will find one more image:
|
||||
|
||||
- `opea/llm-faqgen:latest`
|
||||
|
||||
## 🚀 Start MicroServices and MegaService
|
||||
|
||||
### Required Models
|
||||
@@ -190,6 +202,7 @@ Change the `xxx_MODEL_ID` below for your needs.
|
||||
export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001
|
||||
export CHATQNA_REDIS_DATAPREP_PORT=6007
|
||||
export CHATQNA_REDIS_RETRIEVER_PORT=7000
|
||||
export CHATQNA_LLM_FAQGEN_PORT=9000
|
||||
export CHATQNA_INDEX_NAME="rag-redis"
|
||||
export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP}
|
||||
export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP}
|
||||
@@ -246,7 +259,10 @@ Please find more information about accessing and restricting AMD GPUs in the lin
|
||||
|
||||
```bash
|
||||
cd GenAIExamples/ChatQnA/docker_compose/amd/gpu/rocm
|
||||
## for text generation
|
||||
docker compose up -d
|
||||
## for FAQ generation
|
||||
docker compose -f compose_faqgen.yaml up -d
|
||||
```
|
||||
|
||||
### Validate MicroServices and MegaService
|
||||
@@ -310,7 +326,16 @@ docker compose up -d
|
||||
-H 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
5. MegaService
|
||||
5. FaqGen LLM Microservice (if enabled)
|
||||
|
||||
```bash
|
||||
curl http://${host_ip}:${CHATQNA_LLM_FAQGEN_PORT}/v1/faqgen \
|
||||
-X POST \
|
||||
-d '{"query":"Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5."}' \
|
||||
-H 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
6. MegaService
|
||||
|
||||
```bash
|
||||
curl http://${host_ip}:8888/v1/chatqna -H "Content-Type: application/json" -d '{
|
||||
@@ -318,7 +343,7 @@ docker compose up -d
|
||||
}'
|
||||
```
|
||||
|
||||
6. Nginx Service
|
||||
7. Nginx Service
|
||||
|
||||
```bash
|
||||
curl http://${host_ip}:${NGINX_PORT}/v1/chatqna \
|
||||
@@ -326,7 +351,7 @@ docker compose up -d
|
||||
-d '{"messages": "What is the revenue of Nike in 2023?"}'
|
||||
```
|
||||
|
||||
7. Dataprep Microservice(Optional)
|
||||
8. Dataprep Microservice(Optional)
|
||||
|
||||
If you want to update the default knowledge base, you can use the following commands:
|
||||
|
||||
|
||||
205
ChatQnA/docker_compose/amd/gpu/rocm/compose_faqgen.yaml
Normal file
205
ChatQnA/docker_compose/amd/gpu/rocm/compose_faqgen.yaml
Normal file
@@ -0,0 +1,205 @@
|
||||
# Copyright (C) 2024 Advanced Micro Devices, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
services:
|
||||
chatqna-redis-vector-db:
|
||||
image: redis/redis-stack:7.2.0-v9
|
||||
container_name: redis-vector-db
|
||||
ports:
|
||||
- "${CHATQNA_REDIS_VECTOR_PORT}:6379"
|
||||
- "${CHATQNA_REDIS_VECTOR_INSIGHT_PORT}:8001"
|
||||
chatqna-dataprep-redis-service:
|
||||
image: ${REGISTRY:-opea}/dataprep:${TAG:-latest}
|
||||
container_name: dataprep-redis-server
|
||||
depends_on:
|
||||
- chatqna-redis-vector-db
|
||||
- chatqna-tei-embedding-service
|
||||
ports:
|
||||
- "${CHATQNA_REDIS_DATAPREP_PORT}:5000"
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
REDIS_URL: ${CHATQNA_REDIS_URL}
|
||||
INDEX_NAME: ${CHATQNA_INDEX_NAME}
|
||||
TEI_ENDPOINT: ${CHATQNA_TEI_EMBEDDING_ENDPOINT}
|
||||
HUGGINGFACEHUB_API_TOKEN: ${CHATQNA_HUGGINGFACEHUB_API_TOKEN}
|
||||
chatqna-tei-embedding-service:
|
||||
image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
|
||||
container_name: chatqna-tei-embedding-server
|
||||
ports:
|
||||
- "${CHATQNA_TEI_EMBEDDING_PORT}:80"
|
||||
volumes:
|
||||
- "${MODEL_CACHE:-/var/opea/chatqna-service/data}:/data"
|
||||
shm_size: 1g
|
||||
ipc: host
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
command: --model-id ${CHATQNA_EMBEDDING_MODEL_ID} --auto-truncate
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/card1:/dev/dri/card1
|
||||
- /dev/dri/renderD136:/dev/dri/renderD136
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
chatqna-retriever:
|
||||
image: ${REGISTRY:-opea}/retriever:${TAG:-latest}
|
||||
container_name: chatqna-retriever-redis-server
|
||||
depends_on:
|
||||
- chatqna-redis-vector-db
|
||||
ports:
|
||||
- "${CHATQNA_REDIS_RETRIEVER_PORT}:7000"
|
||||
ipc: host
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
REDIS_URL: ${CHATQNA_REDIS_URL}
|
||||
INDEX_NAME: ${CHATQNA_INDEX_NAME}
|
||||
TEI_EMBEDDING_ENDPOINT: ${CHATQNA_TEI_EMBEDDING_ENDPOINT}
|
||||
LOGFLAG: ${LOGFLAG}
|
||||
RETRIEVER_COMPONENT_NAME: "OPEA_RETRIEVER_REDIS"
|
||||
restart: unless-stopped
|
||||
chatqna-tei-reranking-service:
|
||||
image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
|
||||
container_name: chatqna-tei-reranking-server
|
||||
ports:
|
||||
- "${CHATQNA_TEI_RERANKING_PORT}:80"
|
||||
volumes:
|
||||
- "${MODEL_CACHE:-/var/opea/chatqna-service/data}:/data"
|
||||
shm_size: 1g
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
HF_API_TOKEN: ${CHATQNA_HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_HUB_DISABLE_PROGRESS_BARS: 1
|
||||
HF_HUB_ENABLE_HF_TRANSFER: 0
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/:/dev/dri/
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
command: --model-id ${CHATQNA_RERANK_MODEL_ID} --auto-truncate
|
||||
chatqna-tgi-service:
|
||||
image: ${CHATQNA_TGI_SERVICE_IMAGE}
|
||||
container_name: chatqna-tgi-server
|
||||
ports:
|
||||
- "${CHATQNA_TGI_SERVICE_PORT}:80"
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
HUGGING_FACE_HUB_TOKEN: ${CHATQNA_HUGGINGFACEHUB_API_TOKEN}
|
||||
HF_HUB_DISABLE_PROGRESS_BARS: 1
|
||||
HF_HUB_ENABLE_HF_TRANSFER: 0
|
||||
volumes:
|
||||
- "${MODEL_CACHE:-/var/opea/chatqna-service/data}:/data"
|
||||
shm_size: 1g
|
||||
devices:
|
||||
- /dev/kfd:/dev/kfd
|
||||
- /dev/dri/:/dev/dri/
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
command: --model-id ${CHATQNA_LLM_MODEL_ID}
|
||||
ipc: host
|
||||
chatqna-llm-faqgen:
|
||||
image: ${REGISTRY:-opea}/llm-faqgen:${TAG:-latest}
|
||||
container_name: llm-faqgen-server
|
||||
depends_on:
|
||||
- chatqna-tgi-service
|
||||
ports:
|
||||
- ${CHATQNA_LLM_FAQGEN_PORT:-9000}:9000
|
||||
ipc: host
|
||||
environment:
|
||||
no_proxy: ${no_proxy}
|
||||
http_proxy: ${http_proxy}
|
||||
https_proxy: ${https_proxy}
|
||||
LLM_ENDPOINT: ${LLM_ENDPOINT}
|
||||
LLM_MODEL_ID: ${LLM_MODEL_ID}
|
||||
HF_TOKEN: ${HF_TOKEN}
|
||||
FAQGen_COMPONENT_NAME: ${FAQGen_COMPONENT_NAME:-OpeaFaqGenTgi}
|
||||
LOGFLAG: ${LOGFLAG:-False}
|
||||
restart: unless-stopped
|
||||
chatqna-backend-server:
|
||||
image: ${REGISTRY:-opea}/chatqna:${TAG:-latest}
|
||||
container_name: chatqna-backend-server
|
||||
depends_on:
|
||||
- chatqna-redis-vector-db
|
||||
- chatqna-tei-embedding-service
|
||||
- chatqna-retriever
|
||||
- chatqna-tei-reranking-service
|
||||
- chatqna-tgi-service
|
||||
- chatqna-llm-faqgen
|
||||
ports:
|
||||
- "${CHATQNA_BACKEND_SERVICE_PORT}:8888"
|
||||
environment:
|
||||
- no_proxy=${no_proxy}
|
||||
- https_proxy=${https_proxy}
|
||||
- http_proxy=${http_proxy}
|
||||
- MEGA_SERVICE_HOST_IP=${CHATQNA_MEGA_SERVICE_HOST_IP}
|
||||
- EMBEDDING_SERVER_HOST_IP=${HOST_IP}
|
||||
- EMBEDDING_SERVER_PORT=${CHATQNA_TEI_EMBEDDING_PORT:-80}
|
||||
- RETRIEVER_SERVICE_HOST_IP=${HOST_IP}
|
||||
- RERANK_SERVER_HOST_IP=${HOST_IP}
|
||||
- RERANK_SERVER_PORT=${CHATQNA_TEI_RERANKING_PORT:-80}
|
||||
- LLM_SERVER_HOST_IP=${HOST_IP}
|
||||
- LLM_SERVER_PORT=${CHATQNA_LLM_FAQGEN_PORT:-9000}
|
||||
- LLM_MODEL=${CHATQNA_LLM_MODEL_ID}
|
||||
- CHATQNA_TYPE=${CHATQNA_TYPE:-CHATQNA_FAQGEN}
|
||||
ipc: host
|
||||
restart: always
|
||||
chatqna-ui-server:
|
||||
image: ${REGISTRY:-opea}/chatqna-ui:${TAG:-latest}
|
||||
container_name: chatqna-ui-server
|
||||
depends_on:
|
||||
- chatqna-backend-server
|
||||
ports:
|
||||
- "${CHATQNA_FRONTEND_SERVICE_PORT}:5173"
|
||||
environment:
|
||||
- no_proxy=${no_proxy}
|
||||
- https_proxy=${https_proxy}
|
||||
- http_proxy=${http_proxy}
|
||||
- CHAT_BASE_URL=${CHATQNA_BACKEND_SERVICE_ENDPOINT}
|
||||
- UPLOAD_FILE_BASE_URL=${CHATQNA_DATAPREP_SERVICE_ENDPOINT}
|
||||
- GET_FILE=${CHATQNA_DATAPREP_GET_FILE_ENDPOINT}
|
||||
- DELETE_FILE=${CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT}
|
||||
ipc: host
|
||||
restart: always
|
||||
chatqna-nginx-server:
|
||||
image: ${REGISTRY:-opea}/nginx:${TAG:-latest}
|
||||
container_name: chaqna-nginx-server
|
||||
depends_on:
|
||||
- chatqna-backend-server
|
||||
- chatqna-ui-server
|
||||
ports:
|
||||
- "${CHATQNA_NGINX_PORT}:80"
|
||||
environment:
|
||||
- no_proxy=${no_proxy}
|
||||
- https_proxy=${https_proxy}
|
||||
- http_proxy=${http_proxy}
|
||||
- FRONTEND_SERVICE_IP=${CHATQNA_FRONTEND_SERVICE_IP}
|
||||
- FRONTEND_SERVICE_PORT=${CHATQNA_FRONTEND_SERVICE_PORT}
|
||||
- BACKEND_SERVICE_NAME=${CHATQNA_BACKEND_SERVICE_NAME}
|
||||
- BACKEND_SERVICE_IP=${CHATQNA_BACKEND_SERVICE_IP}
|
||||
- BACKEND_SERVICE_PORT=${CHATQNA_BACKEND_SERVICE_PORT}
|
||||
ipc: host
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
@@ -15,6 +15,7 @@ export CHATQNA_REDIS_VECTOR_PORT=16379
|
||||
export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001
|
||||
export CHATQNA_REDIS_DATAPREP_PORT=6007
|
||||
export CHATQNA_REDIS_RETRIEVER_PORT=7000
|
||||
export CHATQNA_LLM_FAQGEN_PORT=18010
|
||||
export CHATQNA_INDEX_NAME="rag-redis"
|
||||
export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP}
|
||||
export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP}
|
||||
|
||||
Reference in New Issue
Block a user