From 4d9b1daae56b1b48235bcaf0a07b6ba8182073db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 07:40:42 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../intel/hpu/gaudi/README_remote.md | 81 ++++++++++--------- .../intel/hpu/gaudi/compose.yaml | 4 +- .../intel/hpu/gaudi/compose_remote.yaml | 6 +- .../intel/hpu/gaudi/compose_tgi_remote.yaml | 4 +- .../intel/hpu/gaudi/set_env_remote.sh | 2 +- .../src/redux/Conversation/Conversation.ts | 6 +- .../redux/Conversation/ConversationSlice.ts | 12 +-- 7 files changed, 59 insertions(+), 56 deletions(-) diff --git a/ProductivitySuite/docker_compose/intel/hpu/gaudi/README_remote.md b/ProductivitySuite/docker_compose/intel/hpu/gaudi/README_remote.md index c6bd1fd02..73dc84854 100644 --- a/ProductivitySuite/docker_compose/intel/hpu/gaudi/README_remote.md +++ b/ProductivitySuite/docker_compose/intel/hpu/gaudi/README_remote.md @@ -1,6 +1,6 @@ # Build Mega Service of Productivity Suite -This document outlines the deployment process for OPEA Productivity Suite utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Gaudi server and [GenAIExamples](https://github.com/opea-project/GenAIExamples.git) solutions. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. +This document outlines the deployment process for OPEA Productivity Suite utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Gaudi server and [GenAIExamples](https://github.com/opea-project/GenAIExamples.git) solutions. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as `embedding`, `retriever`, `rerank`, and `llm`. ## 🚀 Build Docker Images @@ -10,6 +10,7 @@ Create a directory and clone the GenAIComps repository mkdir genai git clone --branch v1.0 https://github.com/opea-project/GenAIComps.git ``` + Copy patch files related to GenAIComps inside GenAIComps folder and apply the patch ```bash @@ -68,6 +69,7 @@ cd GenAIExamples Copy the patch files related to GenAIExamples into above cloned GenAIExamples folder Apply the patches + ```bash git am *.patch ``` @@ -177,10 +179,10 @@ export tgi_endpoint="Your_Remote_TGI_Endpoint" ``` **To use multiple TGI models** + > Create the model_configs.json file under /GenAIExamples/ProductivitySuite/docker_compose/intel/hpu/gaudi folder > Add the model details as shown in the below example - ```bash cd .. cd docker_compose/intel/hpu/gaudi @@ -190,46 +192,46 @@ touch model_configs.json File Structure: [ - { - "model_name": "Your Model Name", - "displayName": "Model Display Name for the UI", - "endpoint": "Model Endpoint with http/https", - "minToken": 100, //Min Token Value - "maxToken": 2000 //Max Token Value - }, - { - "model_name": "Your Model Name", - "displayName": "Model Display Name for the UI", - "endpoint": "Model Endpoint with http/https", - "minToken": 100, //Min Token Value - "maxToken": 2000 //Max Token Value - } +{ +"model_name": "Your Model Name", +"displayName": "Model Display Name for the UI", +"endpoint": "Model Endpoint with http/https", +"minToken": 100, //Min Token Value +"maxToken": 2000 //Max Token Value +}, +{ +"model_name": "Your Model Name", +"displayName": "Model Display Name for the UI", +"endpoint": "Model Endpoint with http/https", +"minToken": 100, //Min Token Value +"maxToken": 2000 //Max Token Value +} ] Example: [ - { - "model_name": "meta-llama/Meta-Llama-3.1-70B-Instruct", - "displayName": "llama-3.1-70B", - "endpoint": "https:///", - "minToken": 100, - "maxToken": 2000 - }, - { - "model_name": "meta-llama/Meta-Llama-3.1-8B-Instruct", - "displayName": "llama-3.1-8B", - "endpoint": "https:///", - "minToken": 100, - "maxToken": 2000 - }, - { - "model_name": "Intel/neural-chat-7b-v3-3", - "displayName": "neural chat", - "endpoint": "https:///", - "minToken": 100, - "maxToken": 1000 - } +{ +"model_name": "meta-llama/Meta-Llama-3.1-70B-Instruct", +"displayName": "llama-3.1-70B", +"endpoint": "https:///", +"minToken": 100, +"maxToken": 2000 +}, +{ +"model_name": "meta-llama/Meta-Llama-3.1-8B-Instruct", +"displayName": "llama-3.1-8B", +"endpoint": "https:///", +"minToken": 100, +"maxToken": 2000 +}, +{ +"model_name": "Intel/neural-chat-7b-v3-3", +"displayName": "neural chat", +"endpoint": "https:///", +"minToken": 100, +"maxToken": 1000 +} ] > After creating and adding details in the model_configs.json file. Copy the same file into the public folder of the UI @@ -252,16 +254,19 @@ Note: Please replace with `host_ip` with you external IP address, do not use loc ### Start all the services Docker Containers #### Run all services locally + ```bash docker compose -f compose.yaml up -d ``` #### Run TGI and TEI inference remote + ```bash docker compose -f compose_remote.yaml up -d ``` #### Run only TGI remote + ```bash docker compose -f compose_tgi_remote.yaml up -d ``` @@ -270,8 +275,6 @@ docker compose -f compose_tgi_remote.yaml up -d Please refer to [keycloak_setup_guide](keycloak_setup_guide.md) for more detail related to Keycloak configuration setup. - ## 🚀 Launch the UI To access the frontend, open the following URL in your browser: http://{host_ip}:5174. - diff --git a/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose.yaml b/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose.yaml index d15856e27..70c23f963 100644 --- a/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose.yaml +++ b/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose.yaml @@ -167,7 +167,7 @@ services: LANGCHAIN_API_KEY: ${LANGCHAIN_API_KEY} LANGCHAIN_TRACING_V2: ${LANGCHAIN_TRACING_V2} LANGCHAIN_PROJECT: "opea-llm-service" - + restart: unless-stopped chatqna-gaudi-backend-server: image: ${REGISTRY:-opea}/chatqna:${TAG:-latest} @@ -395,4 +395,4 @@ services: restart: always networks: default: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_remote.yaml b/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_remote.yaml index 82408a33f..ef0a89bec 100644 --- a/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_remote.yaml +++ b/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_remote.yaml @@ -102,7 +102,7 @@ services: CLIENTID: ${CLIENTID} CLIENT_SECRET: ${CLIENT_SECRET} TOKEN_URL: ${TOKEN_URL} - + restart: unless-stopped chatqna-gaudi-backend-server: image: ${REGISTRY:-opea}/chatqna:${TAG:-latest} @@ -277,7 +277,7 @@ services: - KEYCLOAK_ADMIN_PASSWORD=admin - KC_PROXY=edge ipc: host - command: + command: - start-dev restart: always productivity-suite-gaudi-react-ui-server: @@ -303,4 +303,4 @@ services: restart: always networks: default: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_tgi_remote.yaml b/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_tgi_remote.yaml index 02ab491e5..664fb8b11 100644 --- a/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_tgi_remote.yaml +++ b/ProductivitySuite/docker_compose/intel/hpu/gaudi/compose_tgi_remote.yaml @@ -145,7 +145,7 @@ services: CLIENTID: ${CLIENTID} CLIENT_SECRET: ${CLIENT_SECRET} TOKEN_URL: ${TOKEN_URL} - + restart: unless-stopped chatqna-gaudi-backend-server: image: ${REGISTRY:-opea}/chatqna:${TAG:-latest} @@ -351,4 +351,4 @@ services: restart: always networks: default: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/ProductivitySuite/docker_compose/intel/hpu/gaudi/set_env_remote.sh b/ProductivitySuite/docker_compose/intel/hpu/gaudi/set_env_remote.sh index 95e240244..600077b22 100644 --- a/ProductivitySuite/docker_compose/intel/hpu/gaudi/set_env_remote.sh +++ b/ProductivitySuite/docker_compose/intel/hpu/gaudi/set_env_remote.sh @@ -54,4 +54,4 @@ export LLM_SERVICE_HOST_PORT_DOCSUM=9003 export PROMPT_COLLECTION_NAME="prompt" export CLIENTID=${clientid} export CLIENT_SECRET=${client_secret} -export TOKEN_URL=${token_url} \ No newline at end of file +export TOKEN_URL=${token_url} diff --git a/ProductivitySuite/ui/react/src/redux/Conversation/Conversation.ts b/ProductivitySuite/ui/react/src/redux/Conversation/Conversation.ts index 72d8d12ca..7d18715df 100644 --- a/ProductivitySuite/ui/react/src/redux/Conversation/Conversation.ts +++ b/ProductivitySuite/ui/react/src/redux/Conversation/Conversation.ts @@ -33,9 +33,9 @@ type file = { export type Model = { model_name: string; displayName: string; - minToken: number, - maxToken:number -} + minToken: number; + maxToken: number; +}; export interface ConversationReducer { selectedConversationId: string; diff --git a/ProductivitySuite/ui/react/src/redux/Conversation/ConversationSlice.ts b/ProductivitySuite/ui/react/src/redux/Conversation/ConversationSlice.ts index 40475234c..6d290b843 100644 --- a/ProductivitySuite/ui/react/src/redux/Conversation/ConversationSlice.ts +++ b/ProductivitySuite/ui/react/src/redux/Conversation/ConversationSlice.ts @@ -18,7 +18,7 @@ import { CHAT_HISTORY_GET, CHAT_HISTORY_DELETE, } from "../../config"; -import { Model } from './Conversation'; +import { Model } from "./Conversation"; const initialState: ConversationReducer = { conversations: [], @@ -79,9 +79,9 @@ export const ConversationSlice = createSlice({ setMaxToken: (state, action: PayloadAction) => { state.maxToken = action.payload; }, - setModels: (state, action: PayloadAction) => { + setModels: (state, action: PayloadAction) => { state.models = action.payload; - } + }, }, extraReducers(builder) { builder.addCase(uploadFile.fulfilled, () => { @@ -245,7 +245,7 @@ export const deleteConversation = createAsyncThunkWrapper( export const doConversation = (conversationRequest: ConversationRequest) => { const { conversationId, userPrompt, messages, model, token, temperature } = conversationRequest; - if(messages.length==1){ + if (messages.length == 1) { store.dispatch(addMessageToMessages(messages[0])); } store.dispatch(addMessageToMessages(userPrompt)); @@ -287,7 +287,7 @@ export const doConversation = (conversationRequest: ConversationRequest) => { const match = msg.data.match(/b'([^']*)'/); if (match && match[1] != "") { const extractedText = match[1]; - result += extractedText.replace("<|eot_id|>","").replace(/\\n/g, "\n"); + result += extractedText.replace("<|eot_id|>", "").replace(/\\n/g, "\n"); store.dispatch(setOnGoingResult(result)); } } catch (e) { @@ -340,7 +340,7 @@ export const { setModel, setMinToken, setMaxToken, - setModels + setModels, } = ConversationSlice.actions; export const conversationSelector = (state: RootState) => state.conversationReducer; export default ConversationSlice.reducer;