GoReed commited on
Commit
a45a161
·
verified ·
1 Parent(s): d75821c

Update agents

Browse files
Files changed (1) hide show
  1. agent.py +5 -5
agent.py CHANGED
@@ -39,7 +39,7 @@ def fetch_file(task_id: str, file_name: str):
39
  try:
40
  response = requests.get(f"{DEFAULT_API_URL}/files/{task_id}")
41
  response.raise_for_status()
42
- with open(f"/content/Final_Assignment_Template/data/question_files/{file_name}", "wb") as f:
43
  f.write(response.content)
44
  file_content = response.content
45
  return file_content
@@ -90,7 +90,7 @@ def read_python_file(file_name: str) -> str:
90
  Returns:
91
  The content of the file.
92
  """
93
- base_path = "/content/Final_Assignment_Template/data/question_files"
94
  with open(os.path.join(base_path, file_name), "r") as f:
95
  return f.read()
96
 
@@ -102,7 +102,7 @@ def read_excel_file(file_name: str) -> str:
102
  Returns:
103
  The content of the file.
104
  """
105
- base_path = "/content/Final_Assignment_Template/data/question_files"
106
  df = pd.read_excel(os.path.join(base_path, file_name))
107
  return df.to_string()
108
 
@@ -145,7 +145,7 @@ print(API_KEY, "HEELLLOOoooooo", os.getenv("OPENAI_API_KEY_AG"))
145
  model = OpenAIServerModel(model_id="gpt-4.1-nano", api_key=API_KEY)
146
  MODEL_ID = "openai/gpt-4.1-nano"
147
 
148
- with open("/content/Final_Assignment_Template/system_prompt.yaml", 'r') as stream:
149
  prompt_templates = yaml.safe_load(stream)
150
 
151
  agent = CodeAgent(
@@ -222,7 +222,7 @@ for index, question in enumerate(questions):
222
  }
223
  )
224
  import json
225
- with open(f"/content/Final_Assignment_Template/data/answers_with_prompt_{MODEL_ID.split('/')[-1]}_with_file_content_handling.json", "w") as f:
226
  json.dump(answers, f, indent=2)
227
  print("Submitting answers...")
228
  submit_answers(answers)
 
39
  try:
40
  response = requests.get(f"{DEFAULT_API_URL}/files/{task_id}")
41
  response.raise_for_status()
42
+ with open(f"data/question_files/{file_name}", "wb") as f:
43
  f.write(response.content)
44
  file_content = response.content
45
  return file_content
 
90
  Returns:
91
  The content of the file.
92
  """
93
+ base_path = "data/question_files"
94
  with open(os.path.join(base_path, file_name), "r") as f:
95
  return f.read()
96
 
 
102
  Returns:
103
  The content of the file.
104
  """
105
+ base_path = "data/question_files"
106
  df = pd.read_excel(os.path.join(base_path, file_name))
107
  return df.to_string()
108
 
 
145
  model = OpenAIServerModel(model_id="gpt-4.1-nano", api_key=API_KEY)
146
  MODEL_ID = "openai/gpt-4.1-nano"
147
 
148
+ with open("system_prompt.yaml", 'r') as stream:
149
  prompt_templates = yaml.safe_load(stream)
150
 
151
  agent = CodeAgent(
 
222
  }
223
  )
224
  import json
225
+ with open(f"data/answers_with_prompt_{MODEL_ID.split('/')[-1]}_with_file_content_handling.json", "w") as f:
226
  json.dump(answers, f, indent=2)
227
  print("Submitting answers...")
228
  submit_answers(answers)