AbdulMoid commited on
Commit
fb3c5a2
·
verified ·
1 Parent(s): 3450961

Update graph_rag.py

Browse files
Files changed (1) hide show
  1. graph_rag.py +8 -4
graph_rag.py CHANGED
@@ -5,8 +5,9 @@ import logging
5
  import subprocess
6
  from dotenv import load_dotenv
7
  import gradio as gr
 
8
 
9
- logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
10
  logger = logging.getLogger(__name__)
11
 
12
  # Load environment variables
@@ -68,7 +69,11 @@ def qa_tool_graph_rag(user_question):
68
 
69
  os.chdir(extract_path)
70
 
71
- answer = run_graphrag_query(user_question, output_dir)
 
 
 
 
72
 
73
  logger.info(f"GraphRAG answer generated: {answer}")
74
 
@@ -84,5 +89,4 @@ def qa_tool_graph_rag(user_question):
84
  if 'output_dir' in locals():
85
  shutil.rmtree(output_dir)
86
 
87
- os.chdir(original_dir) # Return to the original directory
88
-
 
5
  import subprocess
6
  from dotenv import load_dotenv
7
  import gradio as gr
8
+ from utils import patient_info # Importing patient_info from utils
9
 
10
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname=s' - '%(message)s')
11
  logger = logging.getLogger(__name__)
12
 
13
  # Load environment variables
 
69
 
70
  os.chdir(extract_path)
71
 
72
+ # Combine patient_info with user_question
73
+ combined_input = f"{patient_info}\n\n{user_question}"
74
+
75
+ # Run the GraphRAG query with the combined input
76
+ answer = run_graphrag_query(combined_input, output_dir)
77
 
78
  logger.info(f"GraphRAG answer generated: {answer}")
79
 
 
89
  if 'output_dir' in locals():
90
  shutil.rmtree(output_dir)
91
 
92
+ os.chdir(original_dir)