Redmind commited on
Commit
2226e7b
·
verified ·
1 Parent(s): fa41377

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -543,7 +543,7 @@ tools = [
543
 
544
  prompt_template = f"""You are an assistant that helps with document retrieval, excel analysis and visual analysis. Your job is to provide clear, complete, and detailed responses to the following queries. Please give the output response in an user friendly way and remove "**" from the response. For example, document related queries can be answered in a clear and concise way with numbering and not as a paragraph.
545
  For datavisualization, user will ask for inventory report of a particular warehouse. Your job is to return the image path to chat interface and display the image as output.
546
- If the proper response is generated, return the response back. Do not iterate again and again. Do not iterate again and again. Give a clear response. Do not give max iterations error. Give the last iteration responses as agent response.
547
  {{agent_scratchpad}}
548
  Here is the information you need to process:
549
  Question: {{input}}"""
@@ -756,15 +756,7 @@ def answer_question_thread(user_question, chatbot,audio=None):
756
  return user_question, response_text
757
  else:
758
  #if ("max iterations" in response_text):
759
- #print(intermediate_steps)
760
- # Loop through and print all intermediate steps
761
- #for i, (action, observation) in enumerate(intermediate_steps):
762
- #for steps in intermediate_steps:
763
- #print(steps)
764
- #print(f"\nIteration {i + 1}:")
765
- #print(f" Action: {action.tool}")
766
- #print(f" Tool Input: {action.tool_input}")
767
- #print(f" Observation: {observation}")
768
 
769
  return user_question, response_text
770
  # response_text = response_text.replace('\n', ' ').replace(' ', ' ').strip()
 
543
 
544
  prompt_template = f"""You are an assistant that helps with document retrieval, excel analysis and visual analysis. Your job is to provide clear, complete, and detailed responses to the following queries. Please give the output response in an user friendly way and remove "**" from the response. For example, document related queries can be answered in a clear and concise way with numbering and not as a paragraph.
545
  For datavisualization, user will ask for inventory report of a particular warehouse. Your job is to return the image path to chat interface and display the image as output.
546
+ If the proper response is generated, return the response back.
547
  {{agent_scratchpad}}
548
  Here is the information you need to process:
549
  Question: {{input}}"""
 
756
  return user_question, response_text
757
  else:
758
  #if ("max iterations" in response_text):
759
+ response_text = "Sorry. I could not respond your query at the moment. This query is taking a lot of time. Please rephrase your query"
 
 
 
 
 
 
 
 
760
 
761
  return user_question, response_text
762
  # response_text = response_text.replace('\n', ' ').replace(' ', ' ').strip()