Spaces:
Runtime error
Runtime error
Update graph_rag.py
Browse files- graph_rag.py +0 -14
graph_rag.py
CHANGED
|
@@ -72,18 +72,6 @@ def clean_response(response):
|
|
| 72 |
else:
|
| 73 |
# If the search string is not found, return the original response
|
| 74 |
return response
|
| 75 |
-
|
| 76 |
-
def remove_data_reports(response):
|
| 77 |
-
# Regular expression pattern to find "[Data: Reports (XXX)]" and similar patterns
|
| 78 |
-
pattern = r'\[Data: Reports \(\d+\)\]'
|
| 79 |
-
|
| 80 |
-
# Substitute the pattern with an empty string
|
| 81 |
-
cleaned_response = re.sub(pattern, '', response)
|
| 82 |
-
|
| 83 |
-
# Remove extra spaces that might result from the substitution
|
| 84 |
-
cleaned_response = re.sub(r'\s+', ' ', cleaned_response).strip()
|
| 85 |
-
|
| 86 |
-
return cleaned_response
|
| 87 |
|
| 88 |
def qa_tool_graph_rag(user_question):
|
| 89 |
original_dir = os.getcwd() # Store the original directory
|
|
@@ -103,8 +91,6 @@ def qa_tool_graph_rag(user_question):
|
|
| 103 |
|
| 104 |
# Clean the response to remove everything before "SUCCESS: Global Search Response:"
|
| 105 |
answer = clean_response(raw_answer)
|
| 106 |
-
|
| 107 |
-
answer = remove_data_reports(answer)
|
| 108 |
|
| 109 |
logger.info(f"GraphRAG answer generated: {answer}")
|
| 110 |
|
|
|
|
| 72 |
else:
|
| 73 |
# If the search string is not found, return the original response
|
| 74 |
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
def qa_tool_graph_rag(user_question):
|
| 77 |
original_dir = os.getcwd() # Store the original directory
|
|
|
|
| 91 |
|
| 92 |
# Clean the response to remove everything before "SUCCESS: Global Search Response:"
|
| 93 |
answer = clean_response(raw_answer)
|
|
|
|
|
|
|
| 94 |
|
| 95 |
logger.info(f"GraphRAG answer generated: {answer}")
|
| 96 |
|