Pijush2023 commited on
Commit
059e3e4
·
verified ·
1 Parent(s): 3011887

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -166,10 +166,6 @@ prompt = ChatPromptTemplate.from_messages(
166
  ]
167
  )
168
 
169
- # Ensure 'context' and 'question' map correctly to the prompt's expected variables
170
- qa_prompt = prompt
171
-
172
-
173
  # Define the chain for Neo4j-based retrieval and response generation
174
  chain_neo4j = (
175
  RunnableParallel(
@@ -179,16 +175,20 @@ chain_neo4j = (
179
  "agent_scratchpad": retriever_neo4j,
180
  }
181
  )
182
- | qa_prompt
183
  | llm
184
  | StrOutputParser()
185
  )
186
 
187
-
188
  # Define the function to get the response
189
- def get_response(question):
190
  try:
191
- return chain_neo4j.invoke({"input": question, "chat_history": [], "agent_scratchpad": ""})
 
 
 
 
 
192
  except Exception as e:
193
  return f"Error: {str(e)}"
194
 
 
166
  ]
167
  )
168
 
 
 
 
 
169
  # Define the chain for Neo4j-based retrieval and response generation
170
  chain_neo4j = (
171
  RunnableParallel(
 
175
  "agent_scratchpad": retriever_neo4j,
176
  }
177
  )
178
+ | prompt
179
  | llm
180
  | StrOutputParser()
181
  )
182
 
 
183
  # Define the function to get the response
184
+ def get_response(input_text):
185
  try:
186
+ # Adjust input to match expected structure
187
+ return chain_neo4j.invoke({
188
+ "input": input_text,
189
+ "chat_history": [],
190
+ "agent_scratchpad": ""
191
+ })
192
  except Exception as e:
193
  return f"Error: {str(e)}"
194