Ubik80 commited on
Commit
b6af241
·
verified ·
1 Parent(s): bee5328

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +5 -5
agent.py CHANGED
@@ -10,7 +10,6 @@ API_URL = "https://agents-course-unit4-scoring.hf.space"
10
  # ------------------------
11
  # Tool definitions
12
  # ------------------------
13
-
14
  @tool
15
  def fetch_questions() -> list:
16
  """
@@ -52,11 +51,11 @@ def submit_answers(
52
  answers: list
53
  ) -> dict:
54
  """
55
- Submit the agent's answers and get back the scoring.
56
 
57
  :param username: Your HF username for the submission.
58
  :param agent_code: URL to your Space code (for verification).
59
- :param answers: List of dicts with 'task_id' and 'submitted_answer'.
60
  :return: Dict with keys 'score', 'correct_count', 'total_attempted', 'message', etc.
61
  """
62
  payload = {
@@ -68,15 +67,16 @@ def submit_answers(
68
  resp.raise_for_status()
69
  return resp.json()
70
 
 
71
  def create_agent() -> CodeAgent:
72
  """
73
  Build and return a configured CodeAgent using OpenAI GPT-3.5 Turbo.
74
  Expects OPENAI_API_KEY in the environment.
75
  """
76
- model = OpenAIServerModel(model_name="gpt-3.5-turbo")
77
  agent = CodeAgent(
78
  tools=[fetch_questions, fetch_random_question, fetch_file, submit_answers],
79
- model=model,
80
  prompt_template=(
81
  "Here is a GAIA question:\n"
82
  "{question}\n"
 
10
  # ------------------------
11
  # Tool definitions
12
  # ------------------------
 
13
  @tool
14
  def fetch_questions() -> list:
15
  """
 
51
  answers: list
52
  ) -> dict:
53
  """
54
+ Submit the agent's answers to GAIA and return the scoring.
55
 
56
  :param username: Your HF username for the submission.
57
  :param agent_code: URL to your Space code (for verification).
58
+ :param answers: List of dicts each with 'task_id' and 'submitted_answer'.
59
  :return: Dict with keys 'score', 'correct_count', 'total_attempted', 'message', etc.
60
  """
61
  payload = {
 
67
  resp.raise_for_status()
68
  return resp.json()
69
 
70
+
71
  def create_agent() -> CodeAgent:
72
  """
73
  Build and return a configured CodeAgent using OpenAI GPT-3.5 Turbo.
74
  Expects OPENAI_API_KEY in the environment.
75
  """
76
+ openai_model = OpenAIServerModel(model_name="gpt-3.5-turbo")
77
  agent = CodeAgent(
78
  tools=[fetch_questions, fetch_random_question, fetch_file, submit_answers],
79
+ model=openai_model,
80
  prompt_template=(
81
  "Here is a GAIA question:\n"
82
  "{question}\n"