Skip to content

Commit 0317929

Browse files
[Bug: 899] Create a version of DocIndexRetriever example with Zilliz/Milvus as Vector DB (#1616)
Signed-off-by: Shifani Rajabose <srajabose@habana.ai> Co-authored-by: pallavi jaini <pallavi.jaini@intel.com>
1 parent 139f2ae commit 0317929

File tree

9 files changed

+2384
-3
lines changed

9 files changed

+2384
-3
lines changed

DocIndexRetriever/docker_compose/intel/cpu/xeon/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export RETRIEVER_SERVICE_HOST_IP=${host_ip}
5555
export RERANK_SERVICE_HOST_IP=${host_ip}
5656
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8000/v1/retrievaltool"
5757
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/ingest"
58-
cd GenAIExamples/DocIndexRetriever/intel/cpu/xoen/
58+
cd GenAIExamples/DocIndexRetriever/docker_compose/intel/cpu/xeon
5959
docker compose up -d
6060
```
6161

@@ -66,10 +66,18 @@ In that case, start Docker Containers with compose_without_rerank.yaml
6666
export host_ip="YOUR IP ADDR"
6767
export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token}
6868
export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"
69-
cd GenAIExamples/DocIndexRetriever/intel/cpu/xoen/
69+
cd GenAIExamples/DocIndexRetriever/docker_compose/intel/cpu/xeon
7070
docker compose -f compose_without_rerank.yaml up -d
7171
```
7272

73+
To run the DocRetriever with Rerank pipeline using the Milvus vector database, use the compose_milvus.yaml configuration file and set the MILVUS_HOST environment variable.
74+
75+
```bash
76+
export MILVUS_HOST=${host_ip}
77+
cd GenAIExamples/DocIndexRetriever/docker_compose/intel/cpu/xeon
78+
docker compose -f compose_milvus.yaml up -d
79+
```
80+
7381
## 4. Validation
7482

7583
Add Knowledge Base via HTTP Links:
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
version: "3.8"
5+
6+
services:
7+
milvus-etcd:
8+
container_name: milvus-etcd
9+
image: quay.io/coreos/etcd:v3.5.5
10+
environment:
11+
- ETCD_AUTO_COMPACTION_MODE=revision
12+
- ETCD_AUTO_COMPACTION_RETENTION=1000
13+
- ETCD_QUOTA_BACKEND_BYTES=4294967296
14+
- ETCD_SNAPSHOT_COUNT=50000
15+
volumes:
16+
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
17+
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
18+
healthcheck:
19+
test: ["CMD", "etcdctl", "endpoint", "health"]
20+
interval: 30s
21+
timeout: 20s
22+
retries: 3
23+
milvus-minio:
24+
container_name: milvus-minio
25+
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
26+
environment:
27+
MINIO_ACCESS_KEY: minioadmin
28+
MINIO_SECRET_KEY: minioadmin
29+
ports:
30+
- "${MINIO_PORT1:-5044}:9001"
31+
- "${MINIO_PORT2:-5043}:9000"
32+
volumes:
33+
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
34+
command: minio server /minio_data --console-address ":9001"
35+
healthcheck:
36+
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
37+
interval: 30s
38+
timeout: 20s
39+
retries: 3
40+
41+
milvus-standalone:
42+
container_name: milvus-standalone
43+
image: milvusdb/milvus:v2.4.6
44+
command: ["milvus", "run", "standalone"]
45+
security_opt:
46+
- seccomp:unconfined
47+
environment:
48+
ETCD_ENDPOINTS: milvus-etcd:2379
49+
MINIO_ADDRESS: milvus-minio:9000
50+
volumes:
51+
- ${DOCKER_VOLUME_DIRECTORY:-.}/config/milvus.yaml:/milvus/configs/milvus.yaml
52+
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/milvus:/var/lib/milvus
53+
healthcheck:
54+
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
55+
interval: 30s
56+
start_period: 90s
57+
timeout: 20s
58+
retries: 3
59+
ports:
60+
- "19530:19530"
61+
- "${MILVUS_STANDALONE_PORT:-9091}:9091"
62+
depends_on:
63+
- "milvus-etcd"
64+
- "milvus-minio"
65+
66+
dataprep-milvus:
67+
image: ${REGISTRY:-opea}/dataprep:${TAG:-latest}
68+
container_name: dataprep-milvus-server
69+
ports:
70+
- "${DATAPREP_PORT:-6007}:5000"
71+
ipc: host
72+
environment:
73+
no_proxy: ${no_proxy}
74+
http_proxy: ${http_proxy}
75+
https_proxy: ${https_proxy}
76+
DATAPREP_COMPONENT_NAME: "OPEA_DATAPREP_MILVUS"
77+
MILVUS_HOST: ${MILVUS_HOST}
78+
TEI_EMBEDDING_ENDPOINT: ${TEI_EMBEDDING_ENDPOINT}
79+
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
80+
LOGFLAG: ${LOGFLAG}
81+
restart: unless-stopped
82+
depends_on:
83+
tei-embedding-service:
84+
condition: service_healthy
85+
milvus-standalone:
86+
condition: service_healthy
87+
milvus-etcd:
88+
condition: service_healthy
89+
milvus-minio:
90+
condition: service_healthy
91+
92+
tei-embedding-service:
93+
image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
94+
entrypoint: /bin/sh -c "apt-get update && apt-get install -y curl && text-embeddings-router --json-output --model-id ${EMBEDDING_MODEL_ID} --auto-truncate"
95+
container_name: tei-embedding-server
96+
ports:
97+
- "6006:80"
98+
volumes:
99+
- "./data:/data"
100+
shm_size: 1g
101+
environment:
102+
no_proxy: ${no_proxy}
103+
http_proxy: ${http_proxy}
104+
https_proxy: ${https_proxy}
105+
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
106+
host_ip: ${host_ip}
107+
healthcheck:
108+
test: ["CMD-SHELL", "curl -f http://$host_ip:6006/health || exit 1"]
109+
interval: 10s
110+
timeout: 10s
111+
retries: 60
112+
113+
embedding:
114+
image: ${REGISTRY:-opea}/embedding:${TAG:-latest}
115+
container_name: embedding-server
116+
# volumes:
117+
# - $WORKDIR/GenAIExamples/DocIndexRetriever/docker_image_build/GenAIComps/comps:/home/comps
118+
ports:
119+
- "6000:6000"
120+
ipc: host
121+
depends_on:
122+
tei-embedding-service:
123+
condition: service_healthy
124+
environment:
125+
no_proxy: ${no_proxy}
126+
http_proxy: ${http_proxy}
127+
https_proxy: ${https_proxy}
128+
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
129+
TEI_EMBEDDING_ENDPOINT: ${TEI_EMBEDDING_ENDPOINT}
130+
LOGFLAG: ${LOGFLAG}
131+
restart: unless-stopped
132+
133+
retriever:
134+
image: ${REGISTRY:-opea}/retriever:${TAG:-latest}
135+
container_name: retriever-milvus-server
136+
depends_on:
137+
- milvus-standalone
138+
ports:
139+
- "7000:7000"
140+
ipc: host
141+
environment:
142+
no_proxy: ${no_proxy}
143+
http_proxy: ${http_proxy}
144+
https_proxy: ${https_proxy}
145+
MILVUS_HOST: ${host_ip}
146+
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
147+
TEI_EMBEDDING_ENDPOINT: ${TEI_EMBEDDING_ENDPOINT}
148+
LOGFLAG: ${LOGFLAG}
149+
RETRIEVER_COMPONENT_NAME: "OPEA_RETRIEVER_MILVUS"
150+
restart: unless-stopped
151+
152+
tei-reranking-service:
153+
image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
154+
entrypoint: /bin/sh -c "apt-get update && apt-get install -y curl && text-embeddings-router --json-output --model-id ${RERANK_MODEL_ID} --auto-truncate"
155+
container_name: tei-reranking-server
156+
ports:
157+
- "8808:80"
158+
volumes:
159+
- "./data:/data"
160+
shm_size: 1g
161+
environment:
162+
no_proxy: ${no_proxy}
163+
http_proxy: ${http_proxy}
164+
https_proxy: ${https_proxy}
165+
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
166+
HF_HUB_DISABLE_PROGRESS_BARS: 1
167+
HF_HUB_ENABLE_HF_TRANSFER: 0
168+
host_ip: ${host_ip}
169+
healthcheck:
170+
test: ["CMD-SHELL", "curl -f http://$host_ip:8808/health || exit 1"]
171+
interval: 10s
172+
timeout: 10s
173+
retries: 60
174+
175+
reranking:
176+
image: ${REGISTRY:-opea}/reranking:${TAG:-latest}
177+
container_name: reranking-tei-xeon-server
178+
# volumes:
179+
# - $WORKDIR/GenAIExamples/DocIndexRetriever/docker_image_build/GenAIComps/comps:/home/user/comps
180+
depends_on:
181+
tei-reranking-service:
182+
condition: service_healthy
183+
ports:
184+
- "8000:8000"
185+
ipc: host
186+
environment:
187+
no_proxy: ${no_proxy}
188+
http_proxy: ${http_proxy}
189+
https_proxy: ${https_proxy}
190+
RERANK_TYPE: ${RERANK_TYPE}
191+
TEI_RERANKING_ENDPOINT: ${TEI_RERANKING_ENDPOINT}
192+
HUGGINGFACEHUB_API_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
193+
HF_HUB_DISABLE_PROGRESS_BARS: 1
194+
HF_HUB_ENABLE_HF_TRANSFER: 0
195+
LOGFLAG: ${LOGFLAG}
196+
restart: unless-stopped
197+
198+
doc-index-retriever-server:
199+
image: ${REGISTRY:-opea}/doc-index-retriever:${TAG:-latest}
200+
container_name: doc-index-retriever-server
201+
depends_on:
202+
- milvus-standalone
203+
- tei-embedding-service
204+
- embedding
205+
- retriever
206+
- reranking
207+
ports:
208+
- "8889:8889"
209+
environment:
210+
- no_proxy=${no_proxy}
211+
- https_proxy=${https_proxy}
212+
- http_proxy=${http_proxy}
213+
- MEGA_SERVICE_HOST_IP=${MEGA_SERVICE_HOST_IP}
214+
- EMBEDDING_SERVICE_HOST_IP=${EMBEDDING_SERVICE_HOST_IP}
215+
- RETRIEVER_SERVICE_HOST_IP=${RETRIEVER_SERVICE_HOST_IP}
216+
- RERANK_SERVICE_HOST_IP=${RERANK_SERVICE_HOST_IP}
217+
- LLM_SERVICE_HOST_IP=${LLM_SERVICE_HOST_IP}
218+
ipc: host
219+
restart: always
220+
221+
networks:
222+
default:
223+
driver: bridge

0 commit comments

Comments
 (0)