darrenphodgson76 commited on
Commit
2ce2d7e
·
verified ·
1 Parent(s): aee5bda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -37,25 +37,16 @@ search_tool = DuckDuckGoSearchTool()
37
  # --- ReACT + Scratchpad + Auto‐Retry Instruction Prompt ---
38
 
39
  instruction_prompt = """
40
- You are a ReACT agent with scratchpad memory and a retry mechanism.
41
 
42
- For every question:
43
- 1. Thought: Figure out what's needed.
44
- 2. Action: (Optional) Call a tool with a precise query.
45
- 3. Observation: Record tool output.
46
 
47
- If the first Observation is empty or irrelevant:
48
- 4. Thought: Unclear result; reframe and retry.
49
- 5. Action: summarize_query(original question).
50
- 6. Action: DuckDuckGoSearchTool(reframed query).
51
- 7. Observation: Record new result.
52
 
53
- Then:
54
- 8. Thought: Reflect on all observations.
55
- 9. FINAL ANSWER: Provide your answer.
 
56
 
57
- Formatting rules:
58
- 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.
59
  """
60
 
61
  # --- BasicAgent using the new OpenAI client ---
 
37
  # --- ReACT + Scratchpad + Auto‐Retry Instruction Prompt ---
38
 
39
  instruction_prompt = """
 
40
 
41
+ You are a high-precision AI agent. Internally, you may follow the ReACT pattern—thinking step-by-step, invoking tools, observing results, retrying if needed—but you must NOT show any of that. Instead, after you finish reasoning privately, output **exactly** one line:
 
 
 
42
 
43
+ FINAL ANSWER: [your concise answer]
 
 
 
 
44
 
45
+ Rules for the final answer:
46
+ - If it’s a number, output only the digits (no commas, units, or extra text).
47
+ - If it’s a list, output a comma-separated list with no extra punctuation or articles.
48
+ - If it’s a string, output only the words, no “um,” “the,” or other fillers.
49
 
 
 
50
  """
51
 
52
  # --- BasicAgent using the new OpenAI client ---