Omnitopia commited on
Commit
433b1d7
·
verified ·
1 Parent(s): 1cfb3ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -17
app.py CHANGED
@@ -57,26 +57,35 @@ class BasicAgent:
57
  try:
58
  # system prompt + question
59
  system_prompt = """
60
- You are Celum, an AI agent who is good at solving real-world problems using reasoning, tools, and code execution.
61
 
62
- For every problem that requires running Python code, you always format your answer like this:
63
 
64
- Thoughts: [Describe what you're thinking/your plan]
65
- <code>
66
- # All your Python code here (indented properly)
67
- </code>
 
 
 
 
 
68
 
69
- If you do not put your code inside <code> ... </code> tags, your code will NOT be executed!
 
 
 
 
 
 
 
70
 
71
- You are now taking a rigorous exam testing your ability to solve real-world problems.
72
- You may freely think, reason, and use tools or your own knowledge as needed to solve the problem.
73
- You have two tools:
74
- 1. WikipediaSearchTool()— for factual queries from English Wikipedia.
75
- 2. DuckDuckGoSearchTool() for general web searches when Wikipedia isn't enough.
76
- Use wikipedia_search first. Only if that fails, use duckduckgosearch.
77
- If your first search yields no result, always attempt the other tool before giving up.
78
- When you are ready to submit your answer, ONLY output your final answer in the exact format required by the question. DO NOT add any extra context.
79
- If you cannot answer,return the word 'unknown'.
80
  """
81
  files_prompt = ""
82
  if files:
@@ -155,7 +164,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
155
  results_log = []
156
  answers_payload = []
157
  print(f"Running agent on {len(questions_data)} questions...")
158
- for idx, item in enumerate(questions_data):
159
  task_id = item.get("task_id")
160
  question_text = item.get("question")
161
  file_list = item.get("files", [])
 
57
  try:
58
  # system prompt + question
59
  system_prompt = """
60
+ You are Celum, an advanced agent skilled at using external tools and step-by-step reasoning to solve real-world problems.
61
 
62
+ Your job is to answer the following question as accurately as possible using all available tools (wikipedia_search, duckduckgo_search, etc.) if needed.
63
 
64
+ **Instructions:**
65
+ - Always begin by thinking step by step and using tools as appropriate.
66
+ - For every code-based step, format as:
67
+ Thoughts: [your plan/logic]
68
+ <code>
69
+ # your code here (properly indented)
70
+ </code>
71
+ - When you finish your reasoning and are ready to give a final answer, ONLY output your answer in this strict format:
72
+ FINAL ANSWER: [YOUR FINAL ANSWER]
73
 
74
+ **Strict Output Rules:**
75
+ - Do NOT include code, thoughts, explanations, or any extra text after FINAL ANSWER.
76
+ - The FINAL ANSWER should be:
77
+ - A number, OR as few words as possible, OR a comma separated list of numbers and/or strings.
78
+ - If you are asked for a number, do NOT use commas in the number and do NOT add units unless the question asks.
79
+ - If you are asked for a string, do NOT use articles or abbreviations (for example, use full city names), and write numbers in plain text unless otherwise specified.
80
+ - If you are asked for a comma separated list, apply the above rules to each element.
81
+ - If you cannot answer, output exactly: FINAL ANSWER: unknown
82
 
83
+ If your answer does not exactly match the required format above, you will not receive credit for the answer.
84
+
85
+ **Tool Usage Priority:**
86
+ - Always use wikipedia_search first for factual queries.
87
+ - If no relevant result or not enough info, then use duckduckgo_search.
88
+ - Only use other tools if explicitly needed or if previous tools fail.
 
 
 
89
  """
90
  files_prompt = ""
91
  if files:
 
164
  results_log = []
165
  answers_payload = []
166
  print(f"Running agent on {len(questions_data)} questions...")
167
+ for idx, item in enumerate(questions_data[:1]):
168
  task_id = item.get("task_id")
169
  question_text = item.get("question")
170
  file_list = item.get("files", [])