Skip to content

Commit d0cd0aa

Browse files
Update GraphRAG to be compatible with latest component changes (#1427)
- Updated ENV VARS to align with recent changes in neo4j dataprep and retriever. - upgraded tgi-gaudi image version Related to GenAIComps repo issue #1025 (opea-project/GenAIComps#1025) Original PR #1384 Original contributor is @rbrugaro Signed-off-by: Xinyao Wang <[email protected]> Co-authored-by: Liang Lv <[email protected]>
1 parent 0ba3dec commit d0cd0aa

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

GraphRAG/docker_compose/intel/hpu/gaudi/compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ services:
6060
LIMIT_HPU_GRAPH: true
6161
USE_FLASH_ATTENTION: true
6262
FLASH_ATTENTION_RECOMPUTE: true
63+
TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN: false
6364
runtime: habana
6465
cap_add:
6566
- SYS_NICE
@@ -93,6 +94,7 @@ services:
9394
OPENAI_LLM_MODEL: ${OPENAI_LLM_MODEL}
9495
EMBEDDING_MODEL_ID: ${EMBEDDING_MODEL_ID}
9596
LLM_MODEL_ID: ${LLM_MODEL_ID}
97+
MAX_OUTPUT_TOKENS: ${MAX_OUTPUT_TOKENS}
9698
LOGFLAG: ${LOGFLAG}
9799
restart: unless-stopped
98100
retriever-neo4j-llamaindex:
@@ -122,6 +124,7 @@ services:
122124
OPENAI_LLM_MODEL: ${OPENAI_LLM_MODEL}
123125
EMBEDDING_MODEL_ID: ${EMBEDDING_MODEL_ID}
124126
LLM_MODEL_ID: ${LLM_MODEL_ID}
127+
MAX_OUTPUT_TOKENS: ${MAX_OUTPUT_TOKENS}
125128
LOGFLAG: ${LOGFLAG}
126129
RETRIEVER_COMPONENT_NAME: "OPEA_RETRIEVER_NEO4J"
127130
restart: unless-stopped
@@ -144,6 +147,7 @@ services:
144147
- RETRIEVER_SERVICE_PORT=7000
145148
- LLM_SERVER_HOST_IP=tgi-gaudi-service
146149
- LLM_SERVER_PORT=${LLM_SERVER_PORT:-80}
150+
- LLM_MODEL_ID=${LLM_MODEL_ID}
147151
- LOGFLAG=${LOGFLAG}
148152
ipc: host
149153
restart: always

GraphRAG/docker_compose/intel/hpu/gaudi/set_env.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ popd > /dev/null
1212

1313
export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"
1414
export OPENAI_EMBEDDING_MODEL="text-embedding-3-small"
15-
export LLM_MODEL_ID="meta-llama/Meta-Llama-3-8B-Instruct"
15+
export LLM_MODEL_ID="meta-llama/Meta-Llama-3.1-8B-Instruct"
1616
export OPENAI_LLM_MODEL="gpt-4o"
1717
export TEI_EMBEDDING_ENDPOINT="http://${host_ip}:6006"
1818
export TGI_LLM_ENDPOINT="http://${host_ip}:6005"
@@ -21,3 +21,5 @@ export NEO4J_USERNAME=neo4j
2121
export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:5000/v1/dataprep/ingest"
2222
export LOGFLAG=True
2323
export RETRIEVER_SERVICE_PORT=80
24+
export LLM_SERVER_PORT=80
25+
export MAX_OUTPUT_TOKENS=1024

GraphRAG/graphrag.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def generate_rag_prompt(question, documents):
5252
RETRIEVER_SERVICE_PORT = int(os.getenv("RETRIEVER_SERVICE_PORT", 7000))
5353
LLM_SERVER_HOST_IP = os.getenv("LLM_SERVER_HOST_IP", "0.0.0.0")
5454
LLM_SERVER_PORT = int(os.getenv("LLM_SERVER_PORT", 80))
55+
LLM_MODEL_ID = os.getenv("LLM_MODEL_ID", "meta-llama/Meta-Llama-3.1-8B-Instruct")
5556

5657

5758
def align_inputs(self, inputs, cur_node, runtime_graph, llm_parameters_dict, **kwargs):
@@ -60,7 +61,7 @@ def align_inputs(self, inputs, cur_node, runtime_graph, llm_parameters_dict, **k
6061
elif self.services[cur_node].service_type == ServiceType.LLM:
6162
# convert TGI/vLLM to unified OpenAI /v1/chat/completions format
6263
next_inputs = {}
63-
next_inputs["model"] = "tgi" # specifically clarify the fake model to make the format unified
64+
next_inputs["model"] = LLM_MODEL_ID
6465
next_inputs["messages"] = [{"role": "user", "content": inputs["inputs"]}]
6566
next_inputs["max_tokens"] = llm_parameters_dict["max_tokens"]
6667
next_inputs["top_p"] = llm_parameters_dict["top_p"]

GraphRAG/tests/test_compose_on_gaudi.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (C) 2024 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44

5-
set -xe
5+
set -x
66
IMAGE_REPO=${IMAGE_REPO:-"opea"}
77
IMAGE_TAG=${IMAGE_TAG:-"latest"}
88
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
@@ -51,6 +51,8 @@ function start_services() {
5151
export TGI_LLM_ENDPOINT="http://${ip_address}:6005"
5252
export host_ip=${ip_address}
5353
export LOGFLAG=true
54+
export MAX_OUTPUT_TOKENS="1024"
55+
unset OPENAI_API_KEY
5456

5557
# Start Docker Containers
5658
docker compose -f compose.yaml up -d > ${LOG_PATH}/start_services_with_compose.log
@@ -76,6 +78,7 @@ function validate_service() {
7678
if [[ $SERVICE_NAME == *"extract_graph_neo4j"* ]]; then
7779
cd $LOG_PATH
7880
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST -F 'files=@./dataprep_file.txt' -H 'Content-Type: multipart/form-data' "$URL")
81+
echo $HTTP_RESPONSE
7982
elif [[ $SERVICE_NAME == *"neo4j-apoc"* ]]; then
8083
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" "$URL")
8184
else
@@ -211,7 +214,7 @@ function main() {
211214
echo "Mega service start duration is $duration s"
212215

213216
if [ "${mode}" == "perf" ]; then
214-
python3 $WORKPATH/tests/chatqna_benchmark.py
217+
echo "not implemented"
215218
elif [ "${mode}" == "" ]; then
216219
validate_microservices
217220
validate_megaservice

GraphRAG/ui/svelte/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineConfig({
2121
* Maximum time expect() should wait for the condition to be met.
2222
* For example in `await expect(locator).toHaveText();`
2323
*/
24-
timeout: 30000,
24+
timeout: 300000,
2525
},
2626
/* Run tests in files in parallel */
2727
fullyParallel: true,

0 commit comments

Comments
 (0)