Pijush2023 commited on
Commit
4d50965
·
verified ·
1 Parent(s): c85f33f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -274,9 +274,27 @@ def initialize_agent_with_prompt(prompt_template):
274
  return agent
275
 
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  def generate_answer(message, choice):
278
  logging.debug(f"generate_answer called with prompt_choice: {choice}")
279
 
 
 
 
280
  if choice == "Details":
281
  agent = initialize_agent_with_prompt(QA_CHAIN_PROMPT_1)
282
  elif choice == "Conversational":
 
274
  return agent
275
 
276
 
277
+ # def generate_answer(message, choice):
278
+ # logging.debug(f"generate_answer called with prompt_choice: {choice}")
279
+
280
+ # if choice == "Details":
281
+ # agent = initialize_agent_with_prompt(QA_CHAIN_PROMPT_1)
282
+ # elif choice == "Conversational":
283
+ # agent = initialize_agent_with_prompt(QA_CHAIN_PROMPT_2)
284
+ # else:
285
+ # logging.error(f"Invalid prompt_choice: {choice}. Defaulting to 'Conversational'")
286
+ # agent = initialize_agent_with_prompt(QA_CHAIN_PROMPT_2)
287
+ # response = agent(message)
288
+
289
+ # addresses = extract_addresses(response['output'])
290
+ # return response['output'], addresses
291
+
292
  def generate_answer(message, choice):
293
  logging.debug(f"generate_answer called with prompt_choice: {choice}")
294
 
295
+ # Reset conversational memory
296
+ conversational_memory.clear()
297
+
298
  if choice == "Details":
299
  agent = initialize_agent_with_prompt(QA_CHAIN_PROMPT_1)
300
  elif choice == "Conversational":