Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
fd27ee6
Updating SearchQnA xeon with nginx component
edlee123 Apr 7, 2025
f366570
Update xeon README to use nginx, and instruction to access the UI.
edlee123 Apr 7, 2025
aa96ffe
Reverting back changes
edlee123 Apr 7, 2025
7c8ae4a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 7, 2025
b7f098f
Merge branch 'main' into searchqna_fix
edlee123 Apr 7, 2025
7d18b24
Merging README changes
edlee123 Apr 7, 2025
c8bdc04
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 Apr 7, 2025
4e13de2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 7, 2025
9720561
Update SearchQnA/docker_image_build/build.yaml file to include nginx …
edlee123 Apr 7, 2025
5f5075e
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 Apr 7, 2025
e16d9d4
Merge branch 'main' into searchqna_fix
edlee123 Apr 9, 2025
a8daf7f
Fix unneeded breaks in code blocks, and markdown title formatting
edlee123 Apr 9, 2025
dd9c32e
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 Apr 9, 2025
f52c3db
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
57548b7
Add nginx to SearchQnA hpu compose.yaml
edlee123 Apr 11, 2025
5703ceb
Add nginx to SearchQnA amd compose.yaml
edlee123 Apr 11, 2025
20d0e5a
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 Apr 11, 2025
f9bc776
Add nginx to build_docker_images in unit tests
edlee123 Apr 11, 2025
5c34ed2
Add nginx to SearchQnA for amd rocm compose_vllm.yaml
edlee123 Apr 11, 2025
738cdca
Change playwright config so that unit testis accessing the app via ng…
edlee123 Apr 11, 2025
5fc9901
Add nginx to vllm rocm unit test
edlee123 Apr 12, 2025
8eea721
Modified SearchQnA xeon README.md to be more explicit about best prac…
edlee123 Apr 12, 2025
d69e65c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 12, 2025
5984157
Updated diagram to include nginx, and use names like the container names
edlee123 Apr 12, 2025
03d7502
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 Apr 12, 2025
ea03294
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 12, 2025
758bc8c
Format the microservice chart
edlee123 Apr 12, 2025
ef8e53a
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 Apr 12, 2025
11437ad
Generalize the SearchQnA diagram so its not xeon specific
edlee123 Apr 12, 2025
12c42cf
Merge branch 'main' into searchqna_fix
edlee123 Apr 16, 2025
50b44cb
Merge branch 'main' into searchqna_fix
edlee123 May 5, 2025
b3119be
Update the SearchQnA diagram to use nginx and container labels
edlee123 May 5, 2025
3fae551
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 5, 2025
cbbe4eb
Merge branch 'opea-project:main' into searchqna_fix
edlee123 May 7, 2025
001be5c
Merge branch 'main' into searchqna_fix
edlee123 May 9, 2025
7d281a5
Merge branch 'main' into searchqna_fix
yinghu5 May 13, 2025
d2d7793
Merge branch 'main' into searchqna_fix
yinghu5 May 14, 2025
3f6b7d6
Merge branch 'main' into searchqna_fix
xiguiw May 16, 2025
f68509c
Updated the flow diagram to include Nginx, and with container labeling
edlee123 May 19, 2025
62f9bf5
Revert back to original xeon README.md
edlee123 May 19, 2025
74428a4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2025
152c36f
Reverting back to xeon README.md
edlee123 May 19, 2025
d0d017d
Merge branch 'searchqna_fix' of github.com:edlee123/GenAIExamples int…
edlee123 May 19, 2025
b1c0850
Explicitly link to README.md of hardware implementations rather than …
edlee123 May 19, 2025
618fd75
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2025
11a19ba
Merge branch 'main' into searchqna_fix
edlee123 May 19, 2025
187456b
Merge branch 'main' into searchqna_fix
yinghu5 May 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 67 additions & 34 deletions SearchQnA/docker_compose/intel/cpu/xeon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ docker build --no-cache -t opea/reranking:latest --build-arg https_proxy=$https_
docker build --no-cache -t opea/llm-textgen:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/src/text-generation/Dockerfile .
```

### 5. Build MegaService Docker Image
### 5. Build Nginx Image

```bash
docker build --no-cache -t opea/nginx:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/third_parties/nginx/src/Dockerfile .

```

### 6. Build MegaService Docker Image

To construct the Mega Service, we utilize the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline within the `searchqna.py` Python script. Build the MegaService Docker image using the command below:

Expand All @@ -40,7 +47,7 @@ cd GenAIExamples/SearchQnA
docker build --no-cache -t opea/searchqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
```

### 6. Build UI Docker Image
### 7. Build UI Docker Image

Build frontend Docker image via below command:

Expand All @@ -55,40 +62,47 @@ Then run the command `docker images`, you will have following images ready:
2. `opea/web-retriever:latest`
3. `opea/reranking:latest`
4. `opea/llm-textgen:latest`
5. `opea/searchqna:latest`
6. `opea/searchqna-ui:latest`
5. `opea/nginx:latest`
6. `opea/searchqna:latest`
7. `opea/searchqna-ui:latest`

## 🚀 Set the environment variables

Before starting the services with `docker compose`, you have to recheck the following environment variables.
```bash
cd GenAIExamples/SearchQnA/docker_compose/
```

Before starting the services with `docker compose`, you have to recheck the following environment variables. Create a file to store
Comment thread
edlee123 marked this conversation as resolved.
Outdated
your custom environment variables.

```bash
nano setenv_searchqna.sh
```

And paste in the following near top:
Comment thread
edlee123 marked this conversation as resolved.
Outdated

```bash
export host_ip=$(hostname -I | awk '{print $1}')
export no_proxy=""
# Create a Google Programmable / Custom Search Engine: https://programmablesearchengine.google.com/controlpanel/create
export GOOGLE_CSE_ID="my google programmable search key"
# Obtain key: https://developers.google.com/custom-search/v1/introduction
export GOOGLE_API_KEY="my google API key"
export HUGGINGFACEHUB_API_TOKEN="my hugging face token"
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
echo "LLM_MODEL_ID=${LLM_MODEL_ID}"
export LOGFLAG=True
source set_env.sh
```

Then source the environment file:

```bash
export host_ip=<your External Public IP> # export host_ip=$(hostname -I | awk '{print $1}')
export GOOGLE_CSE_ID=<your cse id>
export GOOGLE_API_KEY=<your google api key>
export HUGGINGFACEHUB_API_TOKEN=<your HF token>

export EMBEDDING_MODEL_ID=BAAI/bge-base-en-v1.5
export TEI_EMBEDDING_ENDPOINT=http://${host_ip}:3001
export RERANK_MODEL_ID=BAAI/bge-reranker-base
export TEI_RERANKING_ENDPOINT=http://${host_ip}:3004
export BACKEND_SERVICE_ENDPOINT=http://${host_ip}:3008/v1/searchqna

export TGI_LLM_ENDPOINT=http://${host_ip}:3006
export LLM_MODEL_ID=Intel/neural-chat-7b-v3-3

export MEGA_SERVICE_HOST_IP=${host_ip}
export EMBEDDING_SERVICE_HOST_IP=${host_ip}
export WEB_RETRIEVER_SERVICE_HOST_IP=${host_ip}
export RERANK_SERVICE_HOST_IP=${host_ip}
export LLM_SERVICE_HOST_IP=${host_ip}

export EMBEDDING_SERVICE_PORT=3002
export WEB_RETRIEVER_SERVICE_PORT=3003
export RERANK_SERVICE_PORT=3005
export LLM_SERVICE_PORT=3007
source setenv_searchqna.sh
Comment thread
edlee123 marked this conversation as resolved.
Outdated
```

Sourcing this will also source the standard environment variables in `set_env.sh`.

## 🚀 Start the MegaService

```bash
Expand All @@ -106,7 +120,7 @@ curl http://${host_ip}:3001/embed \
-H 'Content-Type: application/json'

# embedding microservice
curl http://${host_ip}:3002/v1/embeddings\
curl http://${host_ip}:3002/v1/embeddings \
-X POST \
-d '{"text":"hello"}' \
-H 'Content-Type: application/json'
Expand Down Expand Up @@ -134,22 +148,41 @@ curl http://${host_ip}:3005/v1/reranking\
# tgi service
curl http://${host_ip}:3006/generate \
-X POST \
-d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \
-d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":100, "do_sample": true}}' \
-H 'Content-Type: application/json'

# llm microservice
curl http://${host_ip}:3007/v1/chat/completions\
-X POST \
-d '{"query":"What is Deep Learning?","max_tokens":17,"top_k":10,"top_p":0.95,"typical_p":0.95,"temperature":0.01,"repetition_penalty":1.03,"stream":true}' \
-d '{"query":"What is Deep Learning?","max_tokens":100,"top_k":10,"top_p":0.95,"typical_p":0.95,"temperature":0.01,"repetition_penalty":1.03,"stream":false}' \
-H 'Content-Type: application/json'

```

## 🚀 Test MegaService

```bash
````bash
Comment thread
edlee123 marked this conversation as resolved.
Outdated
curl http://${host_ip}:3008/v1/searchqna -H "Content-Type: application/json" -d '{
"messages": "What is the latest news? Give me also the source link.",
"stream": "True"
"stream": "False"
Comment thread
edlee123 marked this conversation as resolved.
Outdated
}'

##. Access frontend
Comment thread
edlee123 marked this conversation as resolved.
Outdated

A quick way to test the frontend with public URL is via Cloudflare TryCloudflare tunnel.

```bash
sudo apt update
sudo apt install -y wget
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

cloudflared tunnel --url http://localhost:80

````

Alternatively a [gradio tunnel](https://console.cloud.intel.com/docs/tutorials/expose_app_tunnels.html) (see bottom).

```

```
21 changes: 19 additions & 2 deletions SearchQnA/docker_compose/intel/cpu/xeon/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,27 @@ services:
- no_proxy=${no_proxy}
- https_proxy=${https_proxy}
- http_proxy=${http_proxy}
- BACKEND_BASE_URL=${BACKEND_SERVICE_ENDPOINT}
ipc: host
restart: always

searchqna-xeon-nginx-server:
image: ${REGISTRY:-opea}/nginx:${TAG:-latest}
container_name: searchqna-xeon-nginx-server
depends_on:
- searchqna-xeon-backend-server
- searchqna-xeon-ui-server
ports:
- "${NGINX_PORT:-80}:80"
environment:
- no_proxy=${no_proxy}
- https_proxy=${https_proxy}
- http_proxy=${http_proxy}
- FRONTEND_SERVICE_IP=searchqna-xeon-ui-server
- FRONTEND_SERVICE_PORT=5173
- BACKEND_SERVICE_NAME=searchqna
- BACKEND_SERVICE_IP=searchqna-xeon-backend-server
- BACKEND_SERVICE_PORT=8888
ipc: host
restart: always

networks:
default:
Expand Down
6 changes: 6 additions & 0 deletions SearchQnA/docker_image_build/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ services:
context: GenAIComps
dockerfile: comps/third_parties/vllm/src/Dockerfile.amd_gpu
image: ${REGISTRY:-opea}/vllm-rocm:${TAG:-latest}
nginx:
build:
context: GenAIComps
dockerfile: comps/third_parties/nginx/src/Dockerfile
extends: searchqna
image: ${REGISTRY:-opea}/nginx:${TAG:-latest}
2 changes: 1 addition & 1 deletion SearchQnA/ui/svelte/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BACKEND_BASE_URL = 'http://backend_address:3008/v1/searchqna'
BACKEND_BASE_URL = '/v1/searchqna'
Loading