aynot commited on
Commit
3edb388
·
1 Parent(s): b8fd611

prepend gaia prompt to all quastions

Browse files
Files changed (2) hide show
  1. agent.py +10 -2
  2. gaia_prompt.txt +1 -0
agent.py CHANGED
@@ -1,5 +1,6 @@
1
  from smolagents import CodeAgent, LiteLLMModel
2
  import os
 
3
 
4
  from tools import initialize_all_available_tools
5
 
@@ -18,9 +19,16 @@ class MyAgent:
18
  max_steps=10,
19
  verbosity_level=verbosity_level
20
  )
 
 
 
21
 
22
  def get_answer(self, question):
23
- answer = self.agent.run(question)
24
- return answer
 
 
 
 
25
 
26
 
 
1
  from smolagents import CodeAgent, LiteLLMModel
2
  import os
3
+ from cloudpathlib import AnyPath
4
 
5
  from tools import initialize_all_available_tools
6
 
 
19
  max_steps=10,
20
  verbosity_level=verbosity_level
21
  )
22
+
23
+ with AnyPath("gaia_prompt.txt").open("r", encoding='utf-8') as f:
24
+ self.gaia_prompt = f.read()
25
 
26
  def get_answer(self, question):
27
+ answer = self.agent.run(self.gaia_prompt + '\n' + question)
28
+
29
+ fa_tmlp = "FINAL ANSWER:"
30
+ if answer.startswith(fa_tmlp):
31
+ answer = answer[len(fa_tmlp):]
32
+ return answer.strip()
33
 
34
 
gaia_prompt.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 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.