From beda609b4b7e5921d4252f71535c6673e027bb1e Mon Sep 17 00:00:00 2001 From: Ying Hu Date: Wed, 28 Aug 2024 20:42:44 +0800 Subject: [PATCH 1/6] Yinghu5 patch 1 (#676) * Update set_env.sh to fix #670 * Update README.md fixed your_ip and host_ip * Update README.md fix your_ip and host_ip --- DocSum/docker/gaudi/README.md | 2 +- DocSum/docker/set_env.sh | 2 +- DocSum/docker/xeon/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DocSum/docker/gaudi/README.md b/DocSum/docker/gaudi/README.md index 742e7202fa..1b0b1a0604 100644 --- a/DocSum/docker/gaudi/README.md +++ b/DocSum/docker/gaudi/README.md @@ -73,7 +73,7 @@ export no_proxy=${your_no_proxy} export http_proxy=${your_http_proxy} export https_proxy=${your_http_proxy} export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export TGI_LLM_ENDPOINT="http://${your_ip}:8008" +export TGI_LLM_ENDPOINT="http://${host_ip}:8008" export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} export MEGA_SERVICE_HOST_IP=${host_ip} export LLM_SERVICE_HOST_IP=${host_ip} diff --git a/DocSum/docker/set_env.sh b/DocSum/docker/set_env.sh index 722b241544..07440475cc 100644 --- a/DocSum/docker/set_env.sh +++ b/DocSum/docker/set_env.sh @@ -5,7 +5,7 @@ export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export TGI_LLM_ENDPOINT="http://${your_ip}:8008" +export TGI_LLM_ENDPOINT="http://${host_ip}:8008" export MEGA_SERVICE_HOST_IP=${host_ip} export LLM_SERVICE_HOST_IP=${host_ip} export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8888/v1/docsum" diff --git a/DocSum/docker/xeon/README.md b/DocSum/docker/xeon/README.md index 96ed905ea7..d3b1c04636 100644 --- a/DocSum/docker/xeon/README.md +++ b/DocSum/docker/xeon/README.md @@ -82,7 +82,7 @@ export no_proxy=${your_no_proxy} export http_proxy=${your_http_proxy} export https_proxy=${your_http_proxy} export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export TGI_LLM_ENDPOINT="http://${your_ip}:8008" +export TGI_LLM_ENDPOINT="http://${host_ip}:8008" export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} export MEGA_SERVICE_HOST_IP=${host_ip} export LLM_SERVICE_HOST_IP=${host_ip} From 7a0fca73e60a7bdd426e3904e4170d88ce53e7a0 Mon Sep 17 00:00:00 2001 From: David Kinder Date: Wed, 28 Aug 2024 08:45:18 -0400 Subject: [PATCH 2/6] doc: fix headings (#656) * doc: fix headings * Fix incorrect uses of heading levels * fix indenting within lists Signed-off-by: David B. Kinder * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: David B. Kinder Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- AgentQnA/README.md | 54 +++--- DocIndexRetriever/docker/README.md | 108 ++++++------ ProductivitySuite/README.md | 2 +- ProductivitySuite/docker/ui/react/README.md | 50 +++--- ProductivitySuite/docker/xeon/README.md | 162 +++++++++--------- .../kubernetes/manifests/README.md | 34 ++-- 6 files changed, 212 insertions(+), 198 deletions(-) diff --git a/AgentQnA/README.md b/AgentQnA/README.md index 41eac2b0eb..11f603d974 100644 --- a/AgentQnA/README.md +++ b/AgentQnA/README.md @@ -26,50 +26,50 @@ This example showcases a hierarchical multi-agent system for question-answering 1. Build agent docker image
First, clone the opea GenAIComps repo -``` -export WORKDIR= -cd $WORKDIR -git clone https://github.com/opea-project/GenAIComps.git -``` + ``` + export WORKDIR= + cd $WORKDIR + git clone https://github.com/opea-project/GenAIComps.git + ``` -Then build the agent docker image. Both the supervisor agent and the worker agent will use the same docker image, but when we launch the two agents we will specify different strategies and register different tools. + Then build the agent docker image. Both the supervisor agent and the worker agent will use the same docker image, but when we launch the two agents we will specify different strategies and register different tools. -``` -cd GenAIComps -docker build -t opea/comps-agent-langchain:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/agent/langchain/docker/Dockerfile . -``` + ``` + cd GenAIComps + docker build -t opea/comps-agent-langchain:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/agent/langchain/docker/Dockerfile . + ``` 2. Launch tool services
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs. -``` -docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0 -``` + ``` + docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0 + ``` 3. Set up environment for this example
First, clone this repo -``` -cd $WORKDIR -git clone https://github.com/opea-project/GenAIExamples.git -``` + ``` + cd $WORKDIR + git clone https://github.com/opea-project/GenAIExamples.git + ``` -Second, set up env vars + Second, set up env vars -``` -export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/ -# optional: OPANAI_API_KEY -export OPENAI_API_KEY= -``` + ``` + export TOOLSET_PATH=$WORKDIR/GenAIExamples/AgentQnA/tools/ + # optional: OPANAI_API_KEY + export OPENAI_API_KEY= + ``` 4. Launch agent services
The configurations of the supervisor agent and the worker agent are defined in the docker-compose yaml file. We currently use openAI GPT-4o-mini as LLM, and we plan to add support for llama3.1-70B-instruct (served by TGI-Gaudi) in a subsequent release. To use openai llm, run command below. -``` -cd docker/openai/ -bash launch_agent_service_openai.sh -``` + ``` + cd docker/openai/ + bash launch_agent_service_openai.sh + ``` ## Validate services diff --git a/DocIndexRetriever/docker/README.md b/DocIndexRetriever/docker/README.md index 722a99e68c..cd884112fd 100644 --- a/DocIndexRetriever/docker/README.md +++ b/DocIndexRetriever/docker/README.md @@ -1,36 +1,36 @@ -# DocRetriever Application +# DocRetriever Application with Docker DocRetriever are the most widely adopted use case for leveraging the different methodologies to match user query against a set of free-text records. DocRetriever is essential to RAG system, which bridges the knowledge gap by dynamically fetching relevant information from external sources, ensuring that responses generated remain factual and current. The core of this architecture are vector databases, which are instrumental in enabling efficient and semantic retrieval of information. These databases store data as vectors, allowing RAG to swiftly access the most pertinent documents or data points based on semantic similarity. -### 1. Build Images for necessary microservices. (This step will not needed after docker image released) +## 1. Build Images for necessary microservices. (This step will not needed after docker image released) - Embedding TEI Image -```bash -git clone https://github.com/opea-project/GenAIComps.git -cd GenAIComps -docker build -t opea/embedding-tei:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/embeddings/langchain/docker/Dockerfile . -``` + ```bash + git clone https://github.com/opea-project/GenAIComps.git + cd GenAIComps + docker build -t opea/embedding-tei:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/embeddings/langchain/docker/Dockerfile . + ``` - Retriever Vector store Image -```bash -docker build -t opea/retriever-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/langchain/redis/docker/Dockerfile . -``` + ```bash + docker build -t opea/retriever-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/langchain/redis/docker/Dockerfile . + ``` - Rerank TEI Image -```bash -docker build -t opea/reranking-tei:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/reranks/tei/docker/Dockerfile . -``` + ```bash + docker build -t opea/reranking-tei:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/reranks/tei/docker/Dockerfile . + ``` - Dataprep Image -```bash -docker build -t opea/dataprep-on-ray-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/langchain_ray/docker/Dockerfile . -``` + ```bash + docker build -t opea/dataprep-on-ray-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/langchain_ray/docker/Dockerfile . + ``` -### 2. Build Images for MegaService +## 2. Build Images for MegaService ```bash cd .. @@ -38,7 +38,7 @@ git clone https://github.com/opea-project/GenAIExamples.git docker build --no-cache -t opea/doc-index-retriever:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f GenAIExamples/DocIndexRetriever/docker/Dockerfile . ``` -### 3. Start all the services Docker Containers +## 3. Start all the services Docker Containers ```bash export host_ip="YOUR IP ADDR" @@ -62,7 +62,7 @@ cd GenAIExamples/DocIndexRetriever/docker/${llm_hardware}/ docker compose -f docker-compose.yaml up -d ``` -### 3. Validation +## 3. Validation Add Knowledge Base via HTTP Links: @@ -86,41 +86,41 @@ curl http://${host_ip}:8889/v1/retrievaltool -X POST -H "Content-Type: applicati {"id":"354e62c703caac8c547b3061433ec5e8","reranked_docs":[{"id":"06d5a5cefc06cf9a9e0b5fa74a9f233c","text":"Close SearchsearchMenu WikiNewsCommunity Daysx-twitter linkedin github searchStreamlining implementation of enterprise-grade Generative AIEfficiently integrate secure, performant, and cost-effective Generative AI workflows into business value.TODAYOPEA..."}],"initial_query":"Explain the OPEA project?"} ``` -### 4. Trouble shooting +## 4. Trouble shooting 1. check all containers are alive -```bash -# redis vector store -docker container logs redis-vector-db -# dataprep to redis microservice, input document files -docker container logs dataprep-redis-server - -# embedding microservice -curl http://${host_ip}:6000/v1/embeddings \ - -X POST \ - -d '{"text":"Explain the OPEA project"}' \ - -H 'Content-Type: application/json' > query -docker container logs embedding-tei-server - -# if you used tei-gaudi -docker container logs tei-embedding-gaudi-server - -# retriever microservice, input embedding output docs -curl http://${host_ip}:7000/v1/retrieval \ - -X POST \ - -d @query \ - -H 'Content-Type: application/json' > rerank_query -docker container logs retriever-redis-server - - -# reranking microservice -curl http://${host_ip}:8000/v1/reranking \ - -X POST \ - -d @rerank_query \ - -H 'Content-Type: application/json' > output -docker container logs reranking-tei-server - -# megaservice gateway -docker container logs doc-index-retriever-server -``` + ```bash + # redis vector store + docker container logs redis-vector-db + # dataprep to redis microservice, input document files + docker container logs dataprep-redis-server + + # embedding microservice + curl http://${host_ip}:6000/v1/embeddings \ + -X POST \ + -d '{"text":"Explain the OPEA project"}' \ + -H 'Content-Type: application/json' > query + docker container logs embedding-tei-server + + # if you used tei-gaudi + docker container logs tei-embedding-gaudi-server + + # retriever microservice, input embedding output docs + curl http://${host_ip}:7000/v1/retrieval \ + -X POST \ + -d @query \ + -H 'Content-Type: application/json' > rerank_query + docker container logs retriever-redis-server + + + # reranking microservice + curl http://${host_ip}:8000/v1/reranking \ + -X POST \ + -d @rerank_query \ + -H 'Content-Type: application/json' > output + docker container logs reranking-tei-server + + # megaservice gateway + docker container logs doc-index-retriever-server + ``` diff --git a/ProductivitySuite/README.md b/ProductivitySuite/README.md index 036b2711ec..448a62dbff 100644 --- a/ProductivitySuite/README.md +++ b/ProductivitySuite/README.md @@ -2,7 +2,7 @@ OPEA Productivity Suite, is a powerful tool designed to streamline your workflow and boost productivity. This application leverages the cutting-edge OPEA microservices to provide a comprehensive suite of features that cater to the diverse needs of modern enterprises. -### Key Features +## Key Features - Chat with Documents: Engage in intelligent conversations with your documents using our advanced RAG Capabilities. Our Retrieval-Augmented Generation (RAG) model allows you to ask questions, receive relevant information, and gain insights from your documents in real-time. diff --git a/ProductivitySuite/docker/ui/react/README.md b/ProductivitySuite/docker/ui/react/README.md index 72703ef3b3..0ad0d23c36 100644 --- a/ProductivitySuite/docker/ui/react/README.md +++ b/ProductivitySuite/docker/ui/react/README.md @@ -1,66 +1,72 @@ -

Productivity Suite React UI

+# Productivity Suite React UI -### 📸 Project Screenshots +## 📸 Project Screenshots ![project-screenshot](../../../assets/img/chat_qna_init.png) ![project-screenshot](../../../assets/img/Login_page.png) -

🧐 Features

+## 🧐 Features Here're some of the project's features: -#### CHAT QNA +### CHAT QNA - Start a Text Chat:Initiate a text chat with the ability to input written conversations, where the dialogue content can also be customized based on uploaded files. - Context Awareness: The AI assistant maintains the context of the conversation, understanding references to previous statements or questions. This allows for more natural and coherent exchanges. - ##### DATA SOURCE +#### DATA SOURCE - - The choice between uploading locally or copying a remote link. Chat according to uploaded knowledge base. - - Uploaded File would get listed and user would be able add or remove file/links +- The choice between uploading locally or copying a remote link. Chat according to uploaded knowledge base. +- Uploaded File would get listed and user would be able add or remove file/links - ###### Screen Shot +##### Screen Shot - ![project-screenshot](../../../assets/img/data_source.png) +![project-screenshot](../../../assets/img/data_source.png) - Clear: Clear the record of the current dialog box without retaining the contents of the dialog box. - Chat history: Historical chat records can still be retained after refreshing, making it easier for users to view the context. - Conversational Chat : The application maintains a history of the conversation, allowing users to review previous messages and the AI to refer back to earlier points in the dialogue when necessary. - ###### Screen Shots - ![project-screenshot](../../../assets/img/chat_qna_init.png) - ![project-screenshot](../../../assets/img/chatqna_with_conversation.png) -#### CODEGEN +##### Screen Shots + +![project-screenshot](../../../assets/img/chat_qna_init.png) +![project-screenshot](../../../assets/img/chatqna_with_conversation.png) + +### CODEGEN - Generate code: generate the corresponding code based on the current user's input. ###### Screen Shot ![project-screenshot](../../../assets/img/codegen.png) -#### DOC SUMMARY +### DOC SUMMARY - Summarizing Uploaded Files: Upload files from their local device, then click 'Generate Summary' to summarize the content of the uploaded file. The summary will be displayed on the 'Summary' box. - Summarizing Text via Pasting: Paste the text to be summarized into the text box, then click 'Generate Summary' to produce a condensed summary of the content, which will be displayed in the 'Summary' box on the right. - Scroll to Bottom: The summarized content will automatically scroll to the bottom. - ###### Screen Shot - ![project-screenshot](../../../assets/img/doc_summary_paste.png) - ![project-screenshot](../../../assets/img/doc_summary_file.png) -#### FAQ Generator +#### Screen Shot + +![project-screenshot](../../../assets/img/doc_summary_paste.png) +![project-screenshot](../../../assets/img/doc_summary_file.png) + +### FAQ Generator - Generate FAQs from Text via Pasting: Paste the text to into the text box, then click 'Generate FAQ' to produce a condensed FAQ of the content, which will be displayed in the 'FAQ' box below. - Generate FAQs from Text via txt file Upload: Upload the file in the Upload bar, then click 'Generate FAQ' to produce a condensed FAQ of the content, which will be displayed in the 'FAQ' box below. - ###### Screen Shot - ![project-screenshot](../../../assets/img/faq_generator.png) -

🛠️ Get it Running:

+#### Screen Shot + +![project-screenshot](../../../assets/img/faq_generator.png) + +## 🛠️ Get it Running: 1. Clone the repo. 2. cd command to the current folder. 3. create a .env file and add the following variables and values. - ```env + ``` VITE_BACKEND_SERVICE_ENDPOINT_CHATQNA='' VITE_BACKEND_SERVICE_ENDPOINT_CODEGEN='' VITE_BACKEND_SERVICE_ENDPOINT_DOCSUM='' diff --git a/ProductivitySuite/docker/xeon/README.md b/ProductivitySuite/docker/xeon/README.md index 0fd16aade4..82b024c524 100644 --- a/ProductivitySuite/docker/xeon/README.md +++ b/ProductivitySuite/docker/xeon/README.md @@ -63,7 +63,7 @@ cd .. The Productivity Suite is composed of multiple GenAIExample reference solutions composed together. -### 8.1 Build ChatQnA MegaService Docker Images +#### 8.1 Build ChatQnA MegaService Docker Images ```bash git clone https://github.com/opea-project/GenAIExamples.git @@ -72,7 +72,7 @@ docker build --no-cache -t opea/chatqna:latest --build-arg https_proxy=$https_pr cd ../../.. ``` -### 8.2 Build DocSum Megaservice Docker Images +#### 8.2 Build DocSum Megaservice Docker Images ```bash cd GenAIExamples/DocSum/docker @@ -80,7 +80,7 @@ docker build --no-cache -t opea/docsum:latest --build-arg https_proxy=$https_pro cd ../../.. ``` -### 8.3 Build CodeGen Megaservice Docker Images +#### 8.3 Build CodeGen Megaservice Docker Images ```bash cd GenAIExamples/CodeGen/docker @@ -88,7 +88,7 @@ docker build --no-cache -t opea/codegen:latest --build-arg https_proxy=$https_pr cd ../../.. ``` -### 8.4 Build FAQGen Megaservice Docker Images +#### 8.4 Build FAQGen Megaservice Docker Images ```bash cd GenAIExamples/FaqGen/docker @@ -206,84 +206,84 @@ Please refer to [keycloak_setup_guide](keycloak_setup_guide.md) for more detail 1. TEI Embedding Service -```bash -curl ${host_ip}:6006/embed \ - -X POST \ - -d '{"inputs":"What is Deep Learning?"}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl ${host_ip}:6006/embed \ + -X POST \ + -d '{"inputs":"What is Deep Learning?"}' \ + -H 'Content-Type: application/json' + ``` 2. Embedding Microservice -```bash -curl http://${host_ip}:6000/v1/embeddings\ - -X POST \ - -d '{"text":"hello"}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl http://${host_ip}:6000/v1/embeddings\ + -X POST \ + -d '{"text":"hello"}' \ + -H 'Content-Type: application/json' + ``` 3. Retriever Microservice -To consume the retriever microservice, you need to generate a mock embedding vector by Python script. The length of embedding vector -is determined by the embedding model. -Here we use the model `EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"`, which vector size is 768. + To consume the retriever microservice, you need to generate a mock embedding vector by Python script. The length of embedding vector + is determined by the embedding model. + Here we use the model `EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"`, which vector size is 768. -Check the vector dimension of your embedding model, set `your_embedding` dimension equals to it. + Check the vector dimension of your embedding model, set `your_embedding` dimension equals to it. -```bash -export your_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") -curl http://${host_ip}:7000/v1/retrieval \ - -X POST \ - -d "{\"text\":\"test\",\"embedding\":${your_embedding}}" \ - -H 'Content-Type: application/json' -``` + ```bash + export your_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") + curl http://${host_ip}:7000/v1/retrieval \ + -X POST \ + -d "{\"text\":\"test\",\"embedding\":${your_embedding}}" \ + -H 'Content-Type: application/json' + ``` 4. TEI Reranking Service -```bash -curl http://${host_ip}:8808/rerank \ - -X POST \ - -d '{"query":"What is Deep Learning?", "texts": ["Deep Learning is not...", "Deep learning is..."]}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl http://${host_ip}:8808/rerank \ + -X POST \ + -d '{"query":"What is Deep Learning?", "texts": ["Deep Learning is not...", "Deep learning is..."]}' \ + -H 'Content-Type: application/json' + ``` 5. Reranking Microservice -```bash -curl http://${host_ip}:8000/v1/reranking\ - -X POST \ - -d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl http://${host_ip}:8000/v1/reranking\ + -X POST \ + -d '{"initial_query":"What is Deep Learning?", "retrieved_docs": [{"text":"Deep Learning is not..."}, {"text":"Deep learning is..."}]}' \ + -H 'Content-Type: application/json' + ``` 6. LLM backend Service (ChatQnA, DocSum, FAQGen) -```bash -curl http://${host_ip}:9009/generate \ - -X POST \ - -d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl http://${host_ip}:9009/generate \ + -X POST \ + -d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \ + -H 'Content-Type: application/json' + ``` -8. LLM backend Service (CodeGen) +7. LLM backend Service (CodeGen) -```bash -curl http://${host_ip}:8028/generate \ - -X POST \ - -d '{"inputs":"def print_hello_world():","parameters":{"max_new_tokens":256, "do_sample": true}}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl http://${host_ip}:8028/generate \ + -X POST \ + -d '{"inputs":"def print_hello_world():","parameters":{"max_new_tokens":256, "do_sample": true}}' \ + -H 'Content-Type: application/json' + ``` -9. ChatQnA LLM Microservice +8. ChatQnA LLM Microservice -```bash -curl http://${host_ip}:9000/v1/chat/completions\ - -X POST \ - -d '{"query":"What is Deep Learning?","max_new_tokens":17,"top_k":10,"top_p":0.95,"typical_p":0.95,"temperature":0.01,"repetition_penalty":1.03,"streaming":true}' \ - -H 'Content-Type: application/json' -``` + ```bash + curl http://${host_ip}:9000/v1/chat/completions\ + -X POST \ + -d '{"query":"What is Deep Learning?","max_new_tokens":17,"top_k":10,"top_p":0.95,"typical_p":0.95,"temperature":0.01,"repetition_penalty":1.03,"streaming":true}' \ + -H 'Content-Type: application/json' + ``` -10. CodeGen LLM Microservice +9. CodeGen LLM Microservice ```bash curl http://${host_ip}:9001/v1/chat/completions\ @@ -498,50 +498,56 @@ Here is an example of running Productivity Suite ![project-screenshot](../../assets/img/chat_qna_init.png) ![project-screenshot](../../assets/img/Login_page.png) -

🧐 Features

+## 🧐 Features Here're some of the project's features: -#### CHAT QNA +### CHAT QNA - Start a Text Chat:Initiate a text chat with the ability to input written conversations, where the dialogue content can also be customized based on uploaded files. - Context Awareness: The AI assistant maintains the context of the conversation, understanding references to previous statements or questions. This allows for more natural and coherent exchanges. - ##### DATA SOURCE +### DATA SOURCE - - The choice between uploading locally or copying a remote link. Chat according to uploaded knowledge base. - - Uploaded File would get listed and user would be able add or remove file/links +- The choice between uploading locally or copying a remote link. Chat according to uploaded knowledge base. +- Uploaded File would get listed and user would be able add or remove file/links - ###### Screen Shot +#### Screen Shot - ![project-screenshot](../../assets/img/data_source.png) +![project-screenshot](../../assets/img/data_source.png) - Clear: Clear the record of the current dialog box without retaining the contents of the dialog box. - Chat history: Historical chat records can still be retained after refreshing, making it easier for users to view the context. - Conversational Chat : The application maintains a history of the conversation, allowing users to review previous messages and the AI to refer back to earlier points in the dialogue when necessary. - ###### Screen Shots - ![project-screenshot](../../assets/img/chat_qna_init.png) - ![project-screenshot](../../assets/img/chatqna_with_conversation.png) -#### CODEGEN +#### Screen Shots + +![project-screenshot](../../assets/img/chat_qna_init.png) +![project-screenshot](../../assets/img/chatqna_with_conversation.png) + +### CODEGEN - Generate code: generate the corresponding code based on the current user's input. ###### Screen Shot ![project-screenshot](../../assets/img/codegen.png) -#### DOC SUMMARY +### DOC SUMMARY - Summarizing Uploaded Files: Upload files from their local device, then click 'Generate Summary' to summarize the content of the uploaded file. The summary will be displayed on the 'Summary' box. - Summarizing Text via Pasting: Paste the text to be summarized into the text box, then click 'Generate Summary' to produce a condensed summary of the content, which will be displayed in the 'Summary' box on the right. - Scroll to Bottom: The summarized content will automatically scroll to the bottom. - ###### Screen Shot - ![project-screenshot](../../assets/img/doc_summary_paste.png) - ![project-screenshot](../../assets/img/doc_summary_file.png) -#### FAQ Generator +#### Screen Shot + +![project-screenshot](../../assets/img/doc_summary_paste.png) +![project-screenshot](../../assets/img/doc_summary_file.png) + +### FAQ Generator - Generate FAQs from Text via Pasting: Paste the text to into the text box, then click 'Generate FAQ' to produce a condensed FAQ of the content, which will be displayed in the 'FAQ' box below. - Generate FAQs from Text via txt file Upload: Upload the file in the Upload bar, then click 'Generate FAQ' to produce a condensed FAQ of the content, which will be displayed in the 'FAQ' box below. - ###### Screen Shot - ![project-screenshot](../../assets/img/faq_generator.png) + +#### Screen Shot + +![project-screenshot](../../assets/img/faq_generator.png) diff --git a/ProductivitySuite/kubernetes/manifests/README.md b/ProductivitySuite/kubernetes/manifests/README.md index 588374cdb0..cfb02c45b2 100644 --- a/ProductivitySuite/kubernetes/manifests/README.md +++ b/ProductivitySuite/kubernetes/manifests/README.md @@ -22,24 +22,26 @@ To begin with, ensure that you have following prerequisites in place: 1. Kubernetes installation: Make sure that you have Kubernetes installed. 2. Images: Make sure you have all the images ready for the examples and components stated above. You may refer to [README](../../docker/xeon/README.md) for steps to build the images. 3. Configuration Values: Set the following values in all the yaml files before proceeding with the deployment: - #### a. HUGGINGFACEHUB_API_TOKEN (Your HuggingFace token to download your desired model from HuggingFace): - ``` - # You may set the HUGGINGFACEHUB_API_TOKEN via method: - export HUGGINGFACEHUB_API_TOKEN="YourOwnToken" - cd GenAIExamples/ProductivitySuite/kubernetes/manifests/xeon/ - sed -i "s/insert-your-huggingface-token-here/${HUGGINGFACEHUB_API_TOKEN}/g" *.yaml - ``` - #### b. Set the proxies based on your network configuration - ``` - # Look for http_proxy, https_proxy and no_proxy key and fill up the values for all the yaml files with your system proxy configuration. - ``` + a. HUGGINGFACEHUB_API_TOKEN (Your HuggingFace token to download your desired model from HuggingFace): + ``` + # You may set the HUGGINGFACEHUB_API_TOKEN via method: + export HUGGINGFACEHUB_API_TOKEN="YourOwnToken" + cd GenAIExamples/ProductivitySuite/kubernetes/manifests/xeon/ + sed -i "s/insert-your-huggingface-token-here/${HUGGINGFACEHUB_API_TOKEN}/g" *.yaml + ``` + + b. Set the proxies based on your network configuration + ``` + # Look for http_proxy, https_proxy and no_proxy key and fill up the values for all the yaml files with your system proxy configuration. + ``` + + c. Set all the backend service endpoint for REACT UI service + ``` + # Setup all the backend service endpoint in productivity_suite_reactui.yaml for UI to consume with. + # Look for ENDPOINT in the yaml and insert all the url endpoint for all the required backend service. + ``` - #### c. Set all the backend service endpoint for REACT UI service - ``` - # Setup all the backend service endpoint in productivity_suite_reactui.yaml for UI to consume with. - # Look for ENDPOINT in the yaml and insert all the url endpoint for all the required backend service. - ``` 4. MODEL_ID and model-volume (OPTIONAL): You may as well customize the "MODEL_ID" to use different model and model-volume for the volume to be mounted. 5. After finish with steps above, you can proceed with the deployment of the yaml file. From 1874dfd14810639dd815c986fce0620092e38a99 Mon Sep 17 00:00:00 2001 From: Abolfazl Shahbazi Date: Wed, 28 Aug 2024 08:30:49 -0700 Subject: [PATCH 3/6] Remove 'vim' from all Dockerfiles (#663) Signed-off-by: Abolfazl Shahbazi Co-authored-by: lvliang-intel --- AudioQnA/docker/Dockerfile | 1 - ChatQnA/docker/Dockerfile | 1 - ChatQnA/docker/Dockerfile_guardrails | 1 - ChatQnA/docker/Dockerfile_without_rerank | 1 - CodeGen/docker/Dockerfile | 1 - CodeTrans/docker/Dockerfile | 1 - DocIndexRetriever/docker/Dockerfile | 3 +-- DocSum/docker/Dockerfile | 1 - FaqGen/docker/Dockerfile | 1 - SearchQnA/docker/Dockerfile | 1 - Translation/docker/Dockerfile | 1 - VisualQnA/docker/Dockerfile | 1 - 12 files changed, 1 insertion(+), 13 deletions(-) diff --git a/AudioQnA/docker/Dockerfile b/AudioQnA/docker/Dockerfile index f85a66a653..e2273d381b 100644 --- a/AudioQnA/docker/Dockerfile +++ b/AudioQnA/docker/Dockerfile @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/ChatQnA/docker/Dockerfile b/ChatQnA/docker/Dockerfile index f65de6e0ee..3439a821e3 100644 --- a/ChatQnA/docker/Dockerfile +++ b/ChatQnA/docker/Dockerfile @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/ChatQnA/docker/Dockerfile_guardrails b/ChatQnA/docker/Dockerfile_guardrails index 84e828c31f..d36a4de503 100644 --- a/ChatQnA/docker/Dockerfile_guardrails +++ b/ChatQnA/docker/Dockerfile_guardrails @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/ChatQnA/docker/Dockerfile_without_rerank b/ChatQnA/docker/Dockerfile_without_rerank index 106d6b5eb5..7b6d0ebcde 100644 --- a/ChatQnA/docker/Dockerfile_without_rerank +++ b/ChatQnA/docker/Dockerfile_without_rerank @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/CodeGen/docker/Dockerfile b/CodeGen/docker/Dockerfile index 84cddf78d2..aee27a8989 100644 --- a/CodeGen/docker/Dockerfile +++ b/CodeGen/docker/Dockerfile @@ -10,7 +10,6 @@ ENV LANG=C.UTF-8 RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/CodeTrans/docker/Dockerfile b/CodeTrans/docker/Dockerfile index a47f9933aa..89bb0b238d 100644 --- a/CodeTrans/docker/Dockerfile +++ b/CodeTrans/docker/Dockerfile @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/DocIndexRetriever/docker/Dockerfile b/DocIndexRetriever/docker/Dockerfile index 72ab4e1d1b..705f250b87 100644 --- a/DocIndexRetriever/docker/Dockerfile +++ b/DocIndexRetriever/docker/Dockerfile @@ -8,7 +8,6 @@ COPY GenAIComps /home/user/GenAIComps RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ @@ -27,4 +26,4 @@ USER user WORKDIR /home/user -ENTRYPOINT ["python", "retrieval_tool.py"] \ No newline at end of file +ENTRYPOINT ["python", "retrieval_tool.py"] diff --git a/DocSum/docker/Dockerfile b/DocSum/docker/Dockerfile index 0128d1ff33..5ffd463217 100644 --- a/DocSum/docker/Dockerfile +++ b/DocSum/docker/Dockerfile @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/FaqGen/docker/Dockerfile b/FaqGen/docker/Dockerfile index f6faa1484b..08307f0046 100644 --- a/FaqGen/docker/Dockerfile +++ b/FaqGen/docker/Dockerfile @@ -9,7 +9,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/SearchQnA/docker/Dockerfile b/SearchQnA/docker/Dockerfile index ec757c622c..3b76d046b6 100644 --- a/SearchQnA/docker/Dockerfile +++ b/SearchQnA/docker/Dockerfile @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/Translation/docker/Dockerfile b/Translation/docker/Dockerfile index ce151bc6cf..d0eef525da 100644 --- a/Translation/docker/Dockerfile +++ b/Translation/docker/Dockerfile @@ -18,7 +18,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ diff --git a/VisualQnA/docker/Dockerfile b/VisualQnA/docker/Dockerfile index a52c4a35c4..f090d3e683 100644 --- a/VisualQnA/docker/Dockerfile +++ b/VisualQnA/docker/Dockerfile @@ -8,7 +8,6 @@ FROM python:3.11-slim RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libjemalloc-dev \ - vim \ git RUN useradd -m -s /bin/bash user && \ From 6f3e54a22a1800570eab0291b9325946e8f02288 Mon Sep 17 00:00:00 2001 From: Abolfazl Shahbazi Date: Wed, 28 Aug 2024 18:35:47 -0700 Subject: [PATCH 4/6] Always upload scan artifacts (#680) Signed-off-by: Abolfazl Shahbazi --- .github/workflows/manual-bom-scan.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/manual-bom-scan.yml b/.github/workflows/manual-bom-scan.yml index 418d41ef51..ebb13fb3a4 100644 --- a/.github/workflows/manual-bom-scan.yml +++ b/.github/workflows/manual-bom-scan.yml @@ -59,6 +59,7 @@ jobs: - name: SBOM Scan Container uses: anchore/sbom-action@v0.17.1 + if: always() with: image: ${{ env.OPEA_IMAGE_REPO }}opea/${{ matrix.image }}:${{ inputs.tag }} output-file: ${{ matrix.image }}-sbom-scan.txt @@ -66,6 +67,7 @@ jobs: - name: Security Scan Container uses: aquasecurity/trivy-action@0.24.0 + if: always() with: image-ref: ${{ env.OPEA_IMAGE_REPO }}opea/${{ matrix.image }}:${{ inputs.tag }} output: ${{ matrix.image }}-trivy-scan.txt @@ -80,6 +82,7 @@ jobs: run: docker rmi -f ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }} - uses: actions/upload-artifact@v4.3.4 + if: always() with: name: ${{ matrix.image }}-scan path: ${{ matrix.image }}-*-scan.txt From 035f39f0d9775100134e3dfaaddac9a82ca92f09 Mon Sep 17 00:00:00 2001 From: "Sun, Xuehao" Date: Thu, 29 Aug 2024 10:27:06 +0800 Subject: [PATCH 5/6] weekly update images tag (#667) Signed-off-by: Sun, Xuehao --- .github/workflows/manual-freeze-images.yml | 43 --------------- ...{freeze_images.sh => update_images_tag.sh} | 22 ++++---- .github/workflows/weekly-update-images.yml | 54 +++++++++++++++++++ 3 files changed, 67 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/manual-freeze-images.yml rename .github/workflows/scripts/{freeze_images.sh => update_images_tag.sh} (53%) create mode 100644 .github/workflows/weekly-update-images.yml diff --git a/.github/workflows/manual-freeze-images.yml b/.github/workflows/manual-freeze-images.yml deleted file mode 100644 index f974340f3b..0000000000 --- a/.github/workflows/manual-freeze-images.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -name: Freeze base images and 3rd party images on manual event - -on: - workflow_dispatch: - -jobs: - freeze-images: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.ref }} - - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: install skopeo - run: | - sudo apt update - sudo apt -y install skopeo - - - name: Set up Git - run: | - git config --global user.name "NeuralChatBot" - git config --global user.email "grp_neural_chat_bot@intel.com" - git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git - - - name: Run script - run: | - bash .github/workflows/scripts/freeze_images.sh - - - name: Commit changes - run: | - git add . - git commit -s -m "Freeze third party images tag" - git push diff --git a/.github/workflows/scripts/freeze_images.sh b/.github/workflows/scripts/update_images_tag.sh similarity index 53% rename from .github/workflows/scripts/freeze_images.sh rename to .github/workflows/scripts/update_images_tag.sh index a6beff89fa..e28b57db40 100644 --- a/.github/workflows/scripts/freeze_images.sh +++ b/.github/workflows/scripts/update_images_tag.sh @@ -4,14 +4,18 @@ # SPDX-License-Identifier: Apache-2.0 declare -A dict -dict["langchain/langchain"]="docker://docker.io/langchain/langchain" -dict["ghcr.io/huggingface/text-generation-inference"]="docker://ghcr.io/huggingface/text-generation-inference" +dict["ghcr.io/huggingface/text-generation-inference"]="docker://ghcr.io/huggingface/text-generation-inference:latest-intel-cpu" function get_latest_version() { repo_image=$1 - versions=$(skopeo list-tags ${dict[$repo_image]} | jq -r '.Tags[]') - printf "version list:\n$versions\n" - latest_version=$(printf "%s\n" "${versions[@]}" | grep -E '^[\.0-9\-]+$' | sort -V | tail -n 1) + if [[ $repo_image == *"huggingface"* ]]; then + revision=$(skopeo inspect --config ${dict[$repo_image]} | jq -r '.config.Labels["org.opencontainers.image.revision"][:7]') + latest_version="sha-$revision-intel-cpu" + else + versions=$(skopeo list-tags ${dict[$repo_image]} | jq -r '.Tags[]') + printf "version list:\n$versions\n" + latest_version=$(printf "%s\n" "${versions[@]}" | grep -E '^[\.0-9\-]+$' | sort -V | tail -n 1) + fi echo "latest version: $latest_version" replace_image_version $repo_image $latest_version } @@ -22,10 +26,10 @@ function replace_image_version() { if [[ -z "$version" ]]; then echo "version is empty" else - echo "replace $repo_image:latest with $repo_image:$version" - find . -name "Dockerfile" | xargs sed -i "s|$repo_image:latest.*|$repo_image:$version|g" - find . -name "*.yaml" | xargs sed -i "s|$repo_image:latest[A-Za-z0-9\-]*|$repo_image:$version|g" - find . -name "*.md" | xargs sed -i "s|$repo_image:latest[A-Za-z0-9\-]*|$repo_image:$version|g" + echo "replace $repo_image:tag with $repo_image:$version" + find . -name "Dockerfile" | xargs sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g" + find . -name "*.yaml" | xargs sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g" + find . -name "*.md" | xargs sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g" fi } diff --git a/.github/workflows/weekly-update-images.yml b/.github/workflows/weekly-update-images.yml new file mode 100644 index 0000000000..520c4780bd --- /dev/null +++ b/.github/workflows/weekly-update-images.yml @@ -0,0 +1,54 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Weekly update base images and 3rd party images + +on: + schedule: + - cron: "0 0 * * 0" + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + freeze-images: + runs-on: ubuntu-latest + env: + USER_NAME: "NeuralChatBot" + USER_EMAIL: "grp_neural_chat_bot@intel.com" + BRANCH_NAME: "update_images_tag" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: "main" + + - name: Install skopeo + run: | + sudo apt update + sudo apt -y install skopeo + + - name: Set up Git + run: | + git config --global user.name ${{ env.USER_NAME }} + git config --global user.email ${{ env.USER_EMAIL }} + git remote set-url origin https://${{ env.USER_NAME }}:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git + git checkout -b ${{ env.BRANCH_NAME }} + + - name: Run script + run: | + bash .github/workflows/scripts/update_images_tag.sh + + - name: Commit changes + run: | + git add . + git commit -s -m "Update third party images tag" + git push --set-upstream origin update_images_tag + + - name: create pull request + run: gh pr create -B main -H ${{ env.BRANCH_NAME }} --title 'Update ghcr.io/huggingface/text-generation-inference image tag' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} From 32afb6501c54782e82746d2fb6079764ddc65bd3 Mon Sep 17 00:00:00 2001 From: WenjiaoYue Date: Thu, 29 Aug 2024 10:29:35 +0800 Subject: [PATCH 6/6] update env (#678) Signed-off-by: Yue, Wenjiao --- ChatQnA/docker/ui/svelte/.env | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChatQnA/docker/ui/svelte/.env b/ChatQnA/docker/ui/svelte/.env index fad2468c0f..d6f7643b62 100644 --- a/ChatQnA/docker/ui/svelte/.env +++ b/ChatQnA/docker/ui/svelte/.env @@ -1,7 +1,7 @@ -CHAT_BASE_URL = 'http://backend_address:8888/v1/chatqna' +CHAT_BASE_URL = '/v1/chatqna' -UPLOAD_FILE_BASE_URL = 'http://backend_address:6007/v1/dataprep' +UPLOAD_FILE_BASE_URL = '/v1/dataprep' -GET_FILE = 'http://backend_address:6007/v1/dataprep/get_file' +GET_FILE = '/v1/dataprep/get_file' -DELETE_FILE = 'http://backend_address:6007/v1/dataprep/delete_file' +DELETE_FILE = '/v1/dataprep/delete_file'