Ubik80 commited on
Commit
ed1bddb
·
verified ·
1 Parent(s): 0a778e2

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +8 -30
agent.py CHANGED
@@ -49,40 +49,18 @@ def submit_answers(username: str, agent_code: str, answers: list) -> dict:
49
 
50
  def create_agent() -> CodeAgent:
51
  """
52
- Build and return a configured CodeAgent using OpenAI GPT-3.5 Turbo,
53
- with a few-shot system prompt tailored to GAIA Level-1 exact-match requirements.
54
  Requires OPENAI_API_KEY in the environment.
 
 
 
55
  """
56
- # 1. Instantiate model
57
- model = OpenAIServerModel(model_id="gpt-3.5-turbo")
58
- # 2. Create the agent with default prompt
 
59
  agent = CodeAgent(
60
  tools=[fetch_questions, fetch_random_question, submit_answers],
61
  model=model
62
  )
63
- # 3. Override its system prompt to include paper’s instructions + few-shot
64
- agent.system_prompt_template = """
65
- You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template:
66
- FINAL ANSWER: [YOUR FINAL ANSWER].
67
-
68
- YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
69
- - If you are asked for a number, don't use commas, symbols or units (e.g. %, $, km) unless explicitly asked.
70
- - If you are asked for a string, don't use articles ("a", "the"), abbreviations (e.g. "NYC"), or extra words; write digits in plain text unless specified otherwise.
71
- - If you are asked for a comma separated list, apply the above rules to each element.
72
-
73
- Example 1:
74
- Question: What is 2 + 2?
75
- Thought: simple arithmetic
76
- FINAL ANSWER: 4
77
-
78
- Example 2:
79
- Question: What is the capital of France?
80
- Thought: common geography
81
- FINAL ANSWER: Paris
82
-
83
- Now it’s your turn.
84
- Question: {task}
85
- """
86
-
87
  return agent
88
-
 
49
 
50
  def create_agent() -> CodeAgent:
51
  """
52
+ Build and return a configured CodeAgent using OpenAI GPT-3.5 Turbo.
 
53
  Requires OPENAI_API_KEY in the environment.
54
+
55
+ Returns:
56
+ CodeAgent: Configured with GAIA tools.
57
  """
58
+ # Initialize the model for CodeAgent
59
+ # Use GPT-4 for improved performance (ensure your API key has GPT-4 access)
60
+ model = OpenAIServerModel(model_id="gpt-4")
61
+ # Instantiate CodeAgent with default prompt and provided tools
62
  agent = CodeAgent(
63
  tools=[fetch_questions, fetch_random_question, submit_answers],
64
  model=model
65
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  return agent