Pijush2023 commited on
Commit
42aa752
·
verified ·
1 Parent(s): 50b7e5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -174,14 +174,6 @@ def generate_response_with_prompt(context, question):
174
 
175
  # Define the function to generate a hybrid response using Neo4j and other retrieval methods
176
  def retriever(question: str):
177
- # Generate the full-text query for Neo4j
178
- full_text_query = generate_full_text_query(question)
179
-
180
- # If the generated query is empty, skip the Neo4j query and return a default response
181
- if not full_text_query:
182
- print("Empty query, skipping Neo4j search.")
183
- return "I'm sorry, I didn't catch that. Could you please repeat your question?"
184
-
185
  # Structured data retrieval from Neo4j
186
  structured_query = f"""
187
  CALL db.index.fulltext.queryNodes('entity', $query, {{limit: 2}})
@@ -190,7 +182,7 @@ def retriever(question: str):
190
  ORDER BY score DESC
191
  LIMIT 2
192
  """
193
- structured_data = graph.query(structured_query, {"query": full_text_query})
194
  structured_response = "\n".join([f"{record['entity']}: {record['context']}" for record in structured_data])
195
 
196
  # Unstructured data retrieval from vector store
 
174
 
175
  # Define the function to generate a hybrid response using Neo4j and other retrieval methods
176
  def retriever(question: str):
 
 
 
 
 
 
 
 
177
  # Structured data retrieval from Neo4j
178
  structured_query = f"""
179
  CALL db.index.fulltext.queryNodes('entity', $query, {{limit: 2}})
 
182
  ORDER BY score DESC
183
  LIMIT 2
184
  """
185
+ structured_data = graph.query(structured_query, {"query": generate_full_text_query(question)})
186
  structured_response = "\n".join([f"{record['entity']}: {record['context']}" for record in structured_data])
187
 
188
  # Unstructured data retrieval from vector store