Skip to content

Commit bbfe10a

Browse files
YongbozzzchyundunovDatamonsters
authored andcommitted
Add new UI/new features for EC-RAG (opea-project#1665)
Signed-off-by: Zhu, Yongbo <yongbo.zhu@intel.com> Signed-off-by: Chingis Yundunov <c.yundunov@datamonsters.com>
1 parent c1a8cdc commit bbfe10a

135 files changed

Lines changed: 8206 additions & 336 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/code_spell_ignore.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
ModelIn
22
modelin
3+
pressEnter

EdgeCraftRAG/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ FROM opea/comps-base:$BASE_TAG
66

77
COPY ./chatqna.py $HOME/chatqna.py
88

9-
ENTRYPOINT ["python", "chatqna.py"]
9+
ENTRYPOINT ["python", "chatqna.py"]

EdgeCraftRAG/Dockerfile.server

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missin
1010
poppler-utils \
1111
tesseract-ocr
1212

13-
RUN apt-get update && apt-get install -y gnupg wget
13+
RUN apt-get update && apt-get install -y gnupg wget git
1414
RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \
1515
gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg
1616
RUN echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \
@@ -33,15 +33,17 @@ RUN chown -R user /templates/default_prompt.txt
3333

3434
COPY ./edgecraftrag /home/user/edgecraftrag
3535

36-
RUN mkdir -p /home/user/gradio_cache
37-
ENV GRADIO_TEMP_DIR=/home/user/gradio_cache
36+
RUN mkdir -p /home/user/ui_cache
37+
ENV UI_UPLOAD_PATH=/home/user/ui_cache
3838

3939
WORKDIR /home/user/edgecraftrag
4040
RUN pip install --no-cache-dir --upgrade pip setuptools==70.0.0 && \
4141
pip install --no-cache-dir -r requirements.txt
4242

4343
WORKDIR /home/user/
44+
RUN git clone https://github.com/openvinotoolkit/openvino.genai.git genai
45+
ENV PYTHONPATH="$PYTHONPATH:/home/user/genai/tools/llm_bench"
4446

4547
USER user
4648

47-
ENTRYPOINT ["python", "-m", "edgecraftrag.server"]
49+
ENTRYPOINT ["python", "-m", "edgecraftrag.server"]

EdgeCraftRAG/README.md

100644100755
Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ quality and performance.
77

88
## What's New in this release?
99

10-
- Support image/url data retrieval and display in EC-RAG
11-
- Support display of document source used by LLM in UI
12-
- Support pipeline remove operation in RESTful API and UI
13-
- Support RAG pipeline performance benchmark and display in UI
10+
- A sleek new UI with enhanced user experience, built on Vue and Ant Design
11+
- Support concurrent multi-requests handling on vLLM inference backend
12+
- Support pipeline configuration through json file
13+
- Support system prompt modification through API
1414
- Fixed known issues in EC-RAG UI and server
1515

1616
## Quick Start Guide
@@ -36,7 +36,7 @@ You can select "local" type in generation field which is the default approach to
3636
#### vLLM with OpenVINO for Intel Arc GPU
3737

3838
You can also select "vLLM" as generation type, to enable this type, you'll need to build the vLLM image for Intel Arc GPU before service bootstrap.
39-
Please follow this link [vLLM with OpenVINO](https://github.com/opea-project/GenAIComps/tree/main/comps/llms/text-generation/vllm/langchain#build-docker-image) to build the vLLM image.
39+
Please follow this link [vLLM with OpenVINO](https://github.com/opea-project/GenAIComps/tree/main/comps/third_parties/vllm#23-vllm-with-openvino-on-intel-gpu-and-cpu) to build the vLLM image.
4040

4141
### Start Edge Craft RAG Services with Docker Compose
4242

@@ -45,12 +45,12 @@ cd GenAIExamples/EdgeCraftRAG/docker_compose/intel/gpu/arc
4545

4646
export MODEL_PATH="your model path for all your models"
4747
export DOC_PATH="your doc path for uploading a dir of files"
48-
export GRADIO_PATH="your gradio cache path for transferring files"
48+
export UI_TMPFILE_PATH="your UI cache path for transferring files"
4949
# If you have a specific prompt template, please uncomment the following line
5050
# export PROMPT_PATH="your prompt path for prompt templates"
5151

5252
# Make sure all 3 folders have 1000:1000 permission, otherwise
53-
# chown 1000:1000 ${MODEL_PATH} ${DOC_PATH} ${GRADIO_PATH}
53+
# chown 1000:1000 ${MODEL_PATH} ${DOC_PATH} ${UI_TMPFILE_PATH}
5454
# In addition, also make sure the .cache folder has 1000:1000 permission, otherwise
5555
# chown 1000:1000 $HOME/.cache
5656

@@ -189,6 +189,12 @@ After the pipeline creation, you can upload your data in the `Chatbot` page.
189189
Then, you can submit messages in the chat box.
190190
![chat_with_rag](assets/img/chat_with_rag.png)
191191

192+
If you want to try Gradio UI, please launch service through compose_gradio.yaml, then access http://${HOST_IP}:8082 on your browser:
193+
194+
```bash
195+
docker compose -f compose_gradio.yaml up -d
196+
```
197+
192198
## Advanced User Guide
193199

194200
### Pipeline Management
@@ -226,8 +232,26 @@ curl -X PATCH http://${HOST_IP}:16010/v1/settings/pipelines/rag_test_local_llm -
226232
curl -X DELETE http://${HOST_IP}:16010/v1/settings/pipelines/rag_test_local_llm -H "Content-Type: application/json" | jq '.'
227233
```
228234

235+
#### Get pipeline json
236+
237+
```bash
238+
curl -X GET http://${HOST_IP}:16010/v1/settings/pipelines/{name}/json -H "Content-Type: application/json" | jq '.'
239+
```
240+
241+
#### Import pipeline from a json file
242+
243+
```bash
244+
curl -X POST http://${HOST_IP}:16010/v1/settings/pipelines/import -H "Content-Type: multipart/form-data" -F "file=@your_test_pipeline_json_file.txt"| jq '.'
245+
```
246+
229247
#### Enable and check benchmark for pipelines
230248

249+
##### ⚠️ NOTICE ⚠️
250+
251+
Benchmarking activities may significantly reduce system performance.
252+
253+
**DO NOT** perform benchmarking in a production environment.
254+
231255
```bash
232256
# Set ENABLE_BENCHMARK as true before launch services
233257
export ENABLE_BENCHMARK="true"
@@ -308,3 +332,11 @@ curl -X DELETE http://${HOST_IP}:16010/v1/data/files/test2.docx -H "Content-Type
308332
```bash
309333
curl -X PATCH http://${HOST_IP}:16010/v1/data/files/test.pdf -H "Content-Type: application/json" -d '{"local_path":"docs/#REPLACE WITH YOUR FILE WITHIN MOUNTED DOC PATH#"}' | jq '.'
310334
```
335+
336+
### System Prompt Management
337+
338+
#### Use custom system prompt
339+
340+
```bash
341+
curl -X POST http://${HOST_IP}:16010/v1/chatqna/prompt -H "Content-Type: multipart/form-data" -F "file=@your_prompt_file.txt"
342+
```

EdgeCraftRAG/assets/img/chat_with_rag.png

100644100755
-65.8 KB
Loading

EdgeCraftRAG/assets/img/create_pipeline.png

100644100755
-83.1 KB
Loading

EdgeCraftRAG/assets/img/upload_data.png

100644100755
-40.1 KB
Loading

EdgeCraftRAG/docker_compose/intel/gpu/arc/compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
volumes:
1616
- ${MODEL_PATH:-${PWD}}:/home/user/models
1717
- ${DOC_PATH:-${PWD}}:/home/user/docs
18-
- ${GRADIO_PATH:-${PWD}}:/home/user/gradio_cache
18+
- ${UI_TMPFILE_PATH:-${PWD}}:/home/user/ui_cache
1919
- ${HF_CACHE:-${HOME}/.cache}:/home/user/.cache
2020
- ${PROMPT_PATH:-${PWD}}:/templates/custom
2121
ports:
@@ -54,7 +54,7 @@ services:
5454
UI_SERVICE_PORT: ${UI_SERVICE_PORT:-8082}
5555
UI_SERVICE_HOST_IP: ${UI_SERVICE_HOST_IP:-0.0.0.0}
5656
volumes:
57-
- ${GRADIO_PATH:-${PWD}}:/home/user/gradio_cache
57+
- ${UI_TMPFILE_PATH:-${PWD}}:/home/user/ui_cache
5858
ports:
5959
- ${UI_SERVICE_PORT:-8082}:${UI_SERVICE_PORT:-8082}
6060
restart: always
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
services:
5+
server:
6+
image: ${REGISTRY:-opea}/edgecraftrag-server:${TAG:-latest}
7+
container_name: edgecraftrag-server
8+
environment:
9+
no_proxy: ${no_proxy}
10+
http_proxy: ${http_proxy}
11+
https_proxy: ${https_proxy}
12+
HF_ENDPOINT: ${HF_ENDPOINT}
13+
vLLM_ENDPOINT: ${vLLM_ENDPOINT}
14+
ENABLE_BENCHMARK: ${ENABLE_BENCHMARK:-false}
15+
volumes:
16+
- ${MODEL_PATH:-${PWD}}:/home/user/models
17+
- ${DOC_PATH:-${PWD}}:/home/user/docs
18+
- ${UI_TMPFILE_PATH:-${PWD}}:/home/user/ui_cache
19+
- ${HF_CACHE:-${HOME}/.cache}:/home/user/.cache
20+
- ${PROMPT_PATH:-${PWD}}:/templates/custom
21+
ports:
22+
- ${PIPELINE_SERVICE_PORT:-16010}:${PIPELINE_SERVICE_PORT:-16010}
23+
devices:
24+
- /dev/dri:/dev/dri
25+
group_add:
26+
- ${VIDEOGROUPID:-44}
27+
- ${RENDERGROUPID:-109}
28+
ecrag:
29+
image: ${REGISTRY:-opea}/edgecraftrag:${TAG:-latest}
30+
container_name: edgecraftrag
31+
environment:
32+
no_proxy: ${no_proxy}
33+
http_proxy: ${http_proxy}
34+
https_proxy: ${https_proxy}
35+
MEGA_SERVICE_PORT: ${MEGA_SERVICE_PORT:-16011}
36+
MEGA_SERVICE_HOST_IP: ${MEGA_SERVICE_HOST_IP:-${HOST_IP}}
37+
PIPELINE_SERVICE_PORT: ${PIPELINE_SERVICE_PORT:-16010}
38+
PIPELINE_SERVICE_HOST_IP: ${PIPELINE_SERVICE_HOST_IP:-${HOST_IP}}
39+
ports:
40+
- ${MEGA_SERVICE_PORT:-16011}:${MEGA_SERVICE_PORT:-16011}
41+
depends_on:
42+
- server
43+
ui:
44+
image: ${REGISTRY:-opea}/edgecraftrag-ui-gradio:${TAG:-latest}
45+
container_name: edgecraftrag-ui
46+
environment:
47+
no_proxy: ${no_proxy}
48+
http_proxy: ${http_proxy}
49+
https_proxy: ${https_proxy}
50+
MEGA_SERVICE_PORT: ${MEGA_SERVICE_PORT:-16011}
51+
MEGA_SERVICE_HOST_IP: ${MEGA_SERVICE_HOST_IP:-${HOST_IP}}
52+
PIPELINE_SERVICE_PORT: ${PIPELINE_SERVICE_PORT:-16010}
53+
PIPELINE_SERVICE_HOST_IP: ${PIPELINE_SERVICE_HOST_IP:-${HOST_IP}}
54+
UI_SERVICE_PORT: ${UI_SERVICE_PORT:-8082}
55+
UI_SERVICE_HOST_IP: ${UI_SERVICE_HOST_IP:-0.0.0.0}
56+
volumes:
57+
- ${UI_TMPFILE_PATH:-${PWD}}:/home/user/ui_cache
58+
ports:
59+
- ${UI_SERVICE_PORT:-8082}:${UI_SERVICE_PORT:-8082}
60+
restart: always
61+
depends_on:
62+
- server
63+
- ecrag
64+
# vllm-openvino-server:
65+
# container_name: vllm-openvino-server
66+
# image: opea/vllm-arc:latest
67+
# ports:
68+
# - ${VLLM_SERVICE_PORT:-8008}:80
69+
# environment:
70+
# HTTPS_PROXY: ${https_proxy}
71+
# HTTP_PROXY: ${https_proxy}
72+
# VLLM_OPENVINO_DEVICE: GPU
73+
# HF_ENDPOINT: ${HF_ENDPOINT}
74+
# HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
75+
# volumes:
76+
# - /dev/dri/by-path:/dev/dri/by-path
77+
# - $HOME/.cache/huggingface:/root/.cache/huggingface
78+
# devices:
79+
# - /dev/dri
80+
# group_add:
81+
# - ${VIDEOGROUPID:-44}
82+
# - ${RENDERGROUPID:-109}
83+
# entrypoint: /bin/bash -c "\
84+
# cd / && \
85+
# export VLLM_CPU_KVCACHE_SPACE=50 && \
86+
# export VLLM_OPENVINO_ENABLE_QUANTIZED_WEIGHTS=ON && \
87+
# python3 -m vllm.entrypoints.openai.api_server \
88+
# --model '${LLM_MODEL}' \
89+
# --max_model_len=1024 \
90+
# --host 0.0.0.0 \
91+
# --port 80"
92+
networks:
93+
default:
94+
driver: bridge

EdgeCraftRAG/docker_compose/intel/gpu/arc/compose_vllm.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
volumes:
1616
- ${MODEL_PATH:-${PWD}}:/home/user/models
1717
- ${DOC_PATH:-${PWD}}:/home/user/docs
18-
- ${GRADIO_PATH:-${PWD}}:/home/user/gradio_cache
18+
- ${UI_TMPFILE_PATH:-${PWD}}:/home/user/ui_cache
1919
- ${HF_CACHE:-${HOME}/.cache}:/home/user/.cache
2020
- ${PROMPT_PATH:-${PWD}}:/templates/custom
2121
ports:
@@ -54,7 +54,7 @@ services:
5454
UI_SERVICE_PORT: ${UI_SERVICE_PORT:-8082}
5555
UI_SERVICE_HOST_IP: ${UI_SERVICE_HOST_IP:-0.0.0.0}
5656
volumes:
57-
- ${GRADIO_PATH:-${PWD}}:/home/user/gradio_cache
57+
- ${UI_TMPFILE_PATH:-${PWD}}:/home/user/ui_cache
5858
ports:
5959
- ${UI_SERVICE_PORT:-8082}:${UI_SERVICE_PORT:-8082}
6060
restart: always

0 commit comments

Comments
 (0)