Bhanu-Chander-ABB commited on
Commit
43c174f
·
1 Parent(s): 4415e11

modified prompt

Browse files
Files changed (1) hide show
  1. app.py +10 -34
app.py CHANGED
@@ -189,53 +189,28 @@ You are an intelligent assistant with access to the following tools:
189
 
190
  {tool_descriptions}
191
 
192
- For every question, always follow this process (your internal thinking/execution process):
193
 
194
- 1. Thought: Reflect step by step on what the user is asking and what information or calculation is needed. Decide if you need to use a tool or can answer directly.
195
- 2. Action: If a tool is needed, specify which tool to use and with what input. If not, state "No action needed".
196
- 3. Observation: If you used a tool, report the tool's output here. If not, write "N/A".
197
- 4. Answer: Give the final answer as a single value (number, string, or comma-separated list), with no extra explanation or units unless requested.
198
-
199
- Your Final Answer should be just [Answer] and should not include any additional text or explanation. Final Answer should be a single value (number, string, or comma-separated list).
200
 
201
  Examples:
202
 
203
  Q: What is 7 * (3 + 2)?
204
- Thought: The user is asking for a math calculation. I should use the calculator tool.
205
- Action: calculator("7 * (3 + 2)")
206
- Observation: 35
207
- Answer: 35
208
-
209
- Your Output (Final Answer) for this question should be: '35'.
210
 
211
  Q: What’s the weather in Tokyo?
212
- Thought: The user wants the current temperature in Tokyo. I should use the get_weather tool.
213
- Action: get_weather("Tokyo")
214
- Observation: 22
215
- Answer: 22
216
-
217
- Your Output (Final Answer) for this question should be: '22'.
218
 
219
  Q: What is the capital of France?
220
- Thought: The user is asking for a factual answer. I can answer directly.
221
- Action: No action needed
222
- Observation: N/A
223
- Answer: Paris
224
-
225
- Your Output (Final Answer) for this question should be: 'Paris'.
226
 
227
  Q: Convert 10 meters to feet.
228
- Thought: The user wants to convert units. I should use the convert_units tool.
229
- Action: convert_units("10 meters to feet")
230
- Observation: 32.81
231
- Answer: 32.81
232
-
233
- Your Output (Final Answer) for this question should be: '32.81'.
234
 
235
  Instructions:
236
- - Always follow the Thought → Action → Observation → Answer for your internal reasoning and execution before giving final answer.
237
- - Use a tool only if necessary, and don't use multiple tools in a call. Don't use a tool if you can answer directly without hallucination.
238
- - Always return your final answer as a single value, with no extra explanation. Don't include your thoughts, actions, or observations in the final answer.
239
  - Be concise and accurate.
240
  """
241
 
@@ -258,6 +233,7 @@ agent = initialize_agent(
258
  llm=chat_llm,
259
  agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
260
  verbose=True,
 
261
  )
262
 
263
 
 
189
 
190
  {tool_descriptions}
191
 
192
+ For every question, you must do your internal reasoning using the Thought → Action → Observation → Answer process, but your output to the user should be ONLY the final answer as a single value (number, string, or comma-separated list), with no extra explanation, thoughts, actions, or observations.
193
 
194
+ **Your output must be only the answer. Do not include any reasoning, tool calls, or explanations.**
 
 
 
 
 
195
 
196
  Examples:
197
 
198
  Q: What is 7 * (3 + 2)?
199
+ Your Output: 35
 
 
 
 
 
200
 
201
  Q: What’s the weather in Tokyo?
202
+ Your Output: 22
 
 
 
 
 
203
 
204
  Q: What is the capital of France?
205
+ Your Output: Paris
 
 
 
 
 
206
 
207
  Q: Convert 10 meters to feet.
208
+ Your Output: 32.81
 
 
 
 
 
209
 
210
  Instructions:
211
+ - Always do your internal reasoning (Thought → Action → Observation → Answer) before producing the answer, but DO NOT show this reasoning to the user.
212
+ - Use a tool only if necessary, and don't use multiple tools in a call. Don't use a tool if you can answer directly.
213
+ - Your output must be a single value (number, string, or comma-separated list) with no extra explanation or formatting.
214
  - Be concise and accurate.
215
  """
216
 
 
233
  llm=chat_llm,
234
  agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
235
  verbose=True,
236
+ handle_parsing_errors=True
237
  )
238
 
239