tatianija commited on
Commit
10d25e1
·
verified ·
1 Parent(s): d8e55a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -32,7 +32,7 @@ class IntelligentAgent:
32
  Use LLM to determine if search is needed for the question.
33
  Returns True if search is recommended, False otherwise.
34
  """
35
- decision_prompt = f"""You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending on whether the element to be put in the list is a number or a string"
36
 
37
  Analyze this question and decide if it requires real-time information, recent data, or specific facts that might not be in your training data.
38
 
@@ -89,8 +89,7 @@ Example responses:
89
  """
90
  Generate answer using LLM without search.
91
  """
92
- answer_prompt = f"""You are a helpful AI assistant. Answer the following question based on your knowledge. Be accurate, concise, and helpful. If you're not certain about something, acknowledge the uncertainty.
93
-
94
  Question: {question}
95
 
96
  Answer:"""
@@ -113,6 +112,7 @@ Answer:"""
113
  """
114
  try:
115
  # Perform search
 
116
  search_results = self.search(question)
117
 
118
  if self.debug:
@@ -149,14 +149,14 @@ Answer:"""
149
  search_context = "\n\n".join(formatted_results)
150
 
151
  # Generate answer using search context
152
- answer_prompt = f"""You are a helpful AI assistant. Use the provided search results to answer the question accurately. Synthesize information from multiple sources when relevant, and cite sources when appropriate.
153
 
154
  Question: {question}
155
 
156
  Search Results:
157
  {search_context}
158
 
159
- Based on the search results above, provide a comprehensive answer to the question. If the search results don't fully answer the question, you can supplement with your general knowledge but clearly indicate what comes from the search results vs. your knowledge.
160
 
161
  Answer:"""
162
 
 
32
  Use LLM to determine if search is needed for the question.
33
  Returns True if search is recommended, False otherwise.
34
  """
35
+ decision_prompt = f"""You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending on whether the element to be put in the list is a number or a string
36
 
37
  Analyze this question and decide if it requires real-time information, recent data, or specific facts that might not be in your training data.
38
 
 
89
  """
90
  Generate answer using LLM without search.
91
  """
92
+ answer_prompt = f"""You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."
 
93
  Question: {question}
94
 
95
  Answer:"""
 
112
  """
113
  try:
114
  # Perform search
115
+ time.sleep(10)
116
  search_results = self.search(question)
117
 
118
  if self.debug:
 
149
  search_context = "\n\n".join(formatted_results)
150
 
151
  # Generate answer using search context
152
+ answer_prompt = f"""You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."
153
 
154
  Question: {question}
155
 
156
  Search Results:
157
  {search_context}
158
 
159
+ Based on the search results above, provide an answer to the question. If the search results don't fully answer the question, you can supplement with your general knowledge.
160
 
161
  Answer:"""
162