razvan-horobeanu commited on
Commit
5b4781b
·
verified ·
1 Parent(s): 008c3ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -27,16 +27,6 @@ visit_webpage = VisitWebpage()
27
  with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
28
  prompt_templates = yaml.safe_load(stream)
29
 
30
- agent2 = CodeAgent(
31
- model=model,
32
- tools=[web_search, visit_webpage],
33
- max_steps=10,
34
- verbosity_level=2,
35
- add_base_tools=True,
36
- planning_interval=3,
37
- prompt_templates=prompt_templates
38
- )
39
-
40
  # --- from template
41
  #class BasicAgent():
42
  # def __init__(self):
@@ -69,7 +59,15 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
69
  # 1. Instantiate Agent ( modify this part to create your agent)
70
  try:
71
  #agent = BasicAgent()
72
- agent = CodeAgent()
 
 
 
 
 
 
 
 
73
  except Exception as e:
74
  print(f"Error instantiating agent: {e}")
75
  return f"Error initializing agent: {e}", None
@@ -109,7 +107,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
109
  print(f"Skipping item with missing task_id or question: {item}")
110
  continue
111
  try:
112
- submitted_answer = agent2(question_text) # modified
113
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
114
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
115
  except Exception as e:
 
27
  with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
28
  prompt_templates = yaml.safe_load(stream)
29
 
 
 
 
 
 
 
 
 
 
 
30
  # --- from template
31
  #class BasicAgent():
32
  # def __init__(self):
 
59
  # 1. Instantiate Agent ( modify this part to create your agent)
60
  try:
61
  #agent = BasicAgent()
62
+ agent = CodeAgent(
63
+ model=model,
64
+ tools=[web_search, visit_webpage],
65
+ max_steps=10,
66
+ verbosity_level=2,
67
+ add_base_tools=True,
68
+ planning_interval=3,
69
+ prompt_templates=prompt_templates
70
+ )
71
  except Exception as e:
72
  print(f"Error instantiating agent: {e}")
73
  return f"Error initializing agent: {e}", None
 
107
  print(f"Skipping item with missing task_id or question: {item}")
108
  continue
109
  try:
110
+ submitted_answer = agent(question_text)
111
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
112
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
113
  except Exception as e: