Redmind commited on
Commit
4b1e599
·
verified ·
1 Parent(s): baa7eb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -544,6 +544,7 @@ tools = [
544
  ]
545
 
546
  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.
 
547
  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.
548
  If the proper response is generated, return the response back.
549
  {{agent_scratchpad}}
@@ -702,7 +703,7 @@ def answer_question_thread(user_question, chatbot,audio=None):
702
  intermediate_steps = []
703
  while iterations < max_iterations:
704
  print(f"flag::{agent_executor.return_intermediate_steps}")
705
- response = agent_executor.invoke({"input": user_question}, config={"callbacks": [langfuse_handler]}, early_stopping_method="generate",max_iterations=1)
706
  print(f"response::{response}")
707
  #print(f"intermediate steps::{intermediate_steps}")
708
  #create_file_HF()
@@ -1093,6 +1094,7 @@ def add_to_redmindgpt(title, summary):
1093
  tools.insert(0, run_time_tool)
1094
 
1095
  prompt_template = f"""You are an assistant that helps with document retrieval, excel analysis, 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.
 
1096
  If the user asks whether the document uploaded or the details about the document, check the available tools and provide the summary of the document uploaded.
1097
  {run_time_tool_summary}
1098
  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.
@@ -1120,6 +1122,7 @@ def add_to_redmindgpt(title, summary):
1120
  tools.insert(0, run_time_excel_tool)
1121
 
1122
  prompt_template = f"""You are an assistant that helps with document retrieval, excel analysis, 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.
 
1123
  If the user asks whether the document uploaded or the details about the document, check the available tools and provide the summary of the document uploaded.
1124
  {run_time_excel_tool_summary}
1125
  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.
 
544
  ]
545
 
546
  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.
547
+ Always provide a final response without looping unnecessarily. If the answer is found, respond immediately.
548
  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.
549
  If the proper response is generated, return the response back.
550
  {{agent_scratchpad}}
 
703
  intermediate_steps = []
704
  while iterations < max_iterations:
705
  print(f"flag::{agent_executor.return_intermediate_steps}")
706
+ response = agent_executor.invoke({"input": user_question}, config={"callbacks": [langfuse_handler]}, early_stopping_method="force",max_iterations=1)
707
  print(f"response::{response}")
708
  #print(f"intermediate steps::{intermediate_steps}")
709
  #create_file_HF()
 
1094
  tools.insert(0, run_time_tool)
1095
 
1096
  prompt_template = f"""You are an assistant that helps with document retrieval, excel analysis, 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.
1097
+ Always provide a final response without looping unnecessarily. If the answer is found, respond immediately.
1098
  If the user asks whether the document uploaded or the details about the document, check the available tools and provide the summary of the document uploaded.
1099
  {run_time_tool_summary}
1100
  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.
 
1122
  tools.insert(0, run_time_excel_tool)
1123
 
1124
  prompt_template = f"""You are an assistant that helps with document retrieval, excel analysis, 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.
1125
+ Always provide a final response without looping unnecessarily. If the answer is found, respond immediately.
1126
  If the user asks whether the document uploaded or the details about the document, check the available tools and provide the summary of the document uploaded.
1127
  {run_time_excel_tool_summary}
1128
  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.