Michele De Stefano commited on
Commit
bc0013e
·
1 Parent(s): b066853

(checkpoint) Obtaining answers.

Browse files
Files changed (2) hide show
  1. agent_factory.py +20 -18
  2. app.py +1 -1
agent_factory.py CHANGED
@@ -30,14 +30,12 @@ class AgentFactory:
30
  """
31
 
32
  __system_prompt: str = (
33
- "You have to answer to test questions and you need to score high.\n"
34
- "Sometimes auxiliary files may be attached to the question so the\n"
35
- "question itself is presented as a JSON string with the following\n"
36
- "fields:\n"
37
  "1. task_id: unique hash identifier of the question.\n"
38
  "2. question: the text of the question.\n"
39
- "3. Level: a number with the question difficulty level. You can ignore "
40
- "this field.\n"
41
  "4. file_name: the name of the file needed to answer the question. "
42
  "This is empty if the question does not refer to any file. "
43
  "IMPORTANT: The text of the question may mention a file name that is "
@@ -45,9 +43,14 @@ class AgentFactory:
45
  "YOU HAVE TO IGNORE THE FILE NAME MENTIONED INTO \"question\" AND "
46
  "YOU MUST USE THE FILE NAME PROVIDED INTO THE \"file_name\" FIELD.\n"
47
  "\n"
48
- "Depending on the question, the\n"
49
- "format of your answer is a number OR as few words as possible OR a\n"
50
- "comma separated list of numbers and/or strings. If you are asked for\n"
 
 
 
 
 
51
  "a number, don't use comma to write your number neither use units\n"
52
  "such as $ or percent sign unless specified otherwise. If you are\n"
53
  "asked for a string, don't use articles, neither abbreviations (e.g.\n"
@@ -55,17 +58,16 @@ class AgentFactory:
55
  "otherwise. If you are asked for a comma separated list, apply the\n"
56
  "above rules depending of whether the element to be put in the list\n"
57
  "is a number or a string.\n"
58
- "When you have to perform a sum, DON'T try to do that yourself.\n"
59
- "Exploit the tool that is able to sum list of numbers. If you have\n"
60
- "to sum the results of previous sums, use again the same tool\n"
61
- "recursively. NEVER do the sums yourself.\n"
62
- "Achieve the solution by dividing your reasoning in steps, and\n"
63
- "provide an explanation for each step.\n"
 
64
  "You are advised to cycle between reasoning and tool calling also\n"
65
  "multiple times. Provide an answer only when you are sure you don't\n"
66
- "have to call any tool again. Provide the answer between\n"
67
- "<ANSWER> and </ANSWER> tags. I stress that the final answer must\n"
68
- "follow the rules explained above.\n"
69
  )
70
 
71
  __llm: Runnable
 
30
  """
31
 
32
  __system_prompt: str = (
33
+ "You have to answer to some test questions.\n"
34
+ "Sometimes auxiliary files may be attached to the question.\n"
35
+ "Each question is a JSON string with the following fields:\n"
 
36
  "1. task_id: unique hash identifier of the question.\n"
37
  "2. question: the text of the question.\n"
38
+ "3. Level: ignore this field.\n"
 
39
  "4. file_name: the name of the file needed to answer the question. "
40
  "This is empty if the question does not refer to any file. "
41
  "IMPORTANT: The text of the question may mention a file name that is "
 
43
  "YOU HAVE TO IGNORE THE FILE NAME MENTIONED INTO \"question\" AND "
44
  "YOU MUST USE THE FILE NAME PROVIDED INTO THE \"file_name\" FIELD.\n"
45
  "\n"
46
+ "Achieve the solution by dividing your reasoning in steps, and\n"
47
+ "provide an explanation for each step.\n"
48
+ "\n"
49
+ "The format of your final answer must be\n"
50
+ "\n"
51
+ "<ANSWER>your_final_answer</Answer>, where your_final_answer is a\n"
52
+ "number OR as few words as possible OR a comma separated list of\n"
53
+ "numbers and/or strings. If you are asked for\n"
54
  "a number, don't use comma to write your number neither use units\n"
55
  "such as $ or percent sign unless specified otherwise. If you are\n"
56
  "asked for a string, don't use articles, neither abbreviations (e.g.\n"
 
58
  "otherwise. If you are asked for a comma separated list, apply the\n"
59
  "above rules depending of whether the element to be put in the list\n"
60
  "is a number or a string.\n"
61
+ "ALWAYS PRESENT THE FINAL ANSWER BETWEEN THE <ANSWER> AND </ANSWER>\n"
62
+ "TAGS.\n"
63
+ "\n"
64
+ "When, for achieving the solution, you have to perform a sum, DON'T\n"
65
+ "try to do that yourself. Exploit the tool that is able to sum a list\n"
66
+ " of numbers. If you have to sum the results of previous sums, use\n"
67
+ "again the same tool, by calling it again.\n"
68
  "You are advised to cycle between reasoning and tool calling also\n"
69
  "multiple times. Provide an answer only when you are sure you don't\n"
70
+ "have to call any tool again."
 
 
71
  )
72
 
73
  __llm: Runnable
app.py CHANGED
@@ -192,7 +192,7 @@ def run_and_submit_all() -> tuple[str, pd.DataFrame | None]:
192
  continue
193
  try:
194
  answer_to_submit = agent(question_text)
195
- answer_payload = {"task_id": task_id, "answer_to_submit": answer_to_submit}
196
  json.dump(answer_payload, f)
197
  f.write("\n")
198
  f.flush()
 
192
  continue
193
  try:
194
  answer_to_submit = agent(question_text)
195
+ answer_payload = {"task_id": task_id, "submitted_answer": answer_to_submit}
196
  json.dump(answer_payload, f)
197
  f.write("\n")
198
  f.flush()