SrcLurker commited on
Commit
240c726
·
1 Parent(s): 1008787

make sure the new code is being run.

Browse files
Files changed (2) hide show
  1. app.py +6 -0
  2. basic_agent.py +7 -3
app.py CHANGED
@@ -31,7 +31,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
31
 
32
  # 1. Instantiate Agent ( modify this part to create your agent)
33
  try:
 
34
  agent = basic_agent.BasicAgent()
 
35
  except Exception as e:
36
  print(f"Error instantiating agent: {e}")
37
  return f"Error initializing agent: {e}", None
@@ -71,7 +73,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
71
  print(f"Skipping item with missing task_id or question: {item}")
72
  continue
73
  try:
 
74
  submitted_answer = agent(question_text)
 
75
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
76
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
77
  except Exception as e:
@@ -183,5 +187,7 @@ if __name__ == "__main__":
183
 
184
  print("-"*(60 + len(" App Starting ")) + "\n")
185
 
 
 
186
  print("Launching Gradio Interface for Basic Agent Evaluation...")
187
  demo.launch(debug=True, share=False)
 
31
 
32
  # 1. Instantiate Agent ( modify this part to create your agent)
33
  try:
34
+ print("This is new code creating the new basic_agent")
35
  agent = basic_agent.BasicAgent()
36
+ print("This is new code creating the new basic_agent is now done")
37
  except Exception as e:
38
  print(f"Error instantiating agent: {e}")
39
  return f"Error initializing agent: {e}", None
 
73
  print(f"Skipping item with missing task_id or question: {item}")
74
  continue
75
  try:
76
+ print(f"calling agent")
77
  submitted_answer = agent(question_text)
78
+ print(f"called agent: {submitted_answer=}")
79
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
80
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
81
  except Exception as e:
 
187
 
188
  print("-"*(60 + len(" App Starting ")) + "\n")
189
 
190
+ print("*"*10, "This is new code!", "*"*10)
191
+
192
  print("Launching Gradio Interface for Basic Agent Evaluation...")
193
  demo.launch(debug=True, share=False)
basic_agent.py CHANGED
@@ -17,7 +17,8 @@ Take the time to plan the steps to reach the solution. Show the steps and then e
17
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
18
  class BasicAgent:
19
  def __init__(self, model_id=None):
20
- print("BasicAgent initialized.")
 
21
  LOG.warning("logging BasicAgent initialized.")
22
 
23
  if model_id:
@@ -33,6 +34,7 @@ class BasicAgent:
33
  # max_new_tokens=32000,
34
  # )
35
 
 
36
  self.model = smolagents.HfApiModel(
37
  max_tokens=32000,
38
  temperature=0.3,
@@ -41,6 +43,7 @@ class BasicAgent:
41
  )
42
  self.tools = [smolagents.DuckDuckGoSearchTool(), smolagents.VisitWebpageTool(), smolagents.FinalAnswerTool()]
43
 
 
44
  self.search_agent = smolagents.CodeAgent(
45
  name="search_agent",
46
  description="Search the web",
@@ -52,6 +55,7 @@ class BasicAgent:
52
  additional_authorized_imports=["duckduckgo_search"],
53
  )
54
 
 
55
  self.manager_agent = smolagents.CodeAgent(
56
  name="manager_agent",
57
  description="Manger of other agents",
@@ -65,8 +69,8 @@ class BasicAgent:
65
  )
66
 
67
  def __call__(self, question: str) -> str:
68
- print(f"Agent received question (first 50 chars): {question[:50]}...")
69
  prompt = f"{SYSTEM_PROMPT}\n\n{question}"
70
  answer = self.manager_agent.run(prompt)
71
- LOG.warning(f"{answer=}")
72
  return answer
 
17
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
18
  class BasicAgent:
19
  def __init__(self, model_id=None):
20
+ print("BasicAgent initializing.")
21
+ # Logs appear to be swallowed.
22
  LOG.warning("logging BasicAgent initialized.")
23
 
24
  if model_id:
 
34
  # max_new_tokens=32000,
35
  # )
36
 
37
+ print("BasicAgent making model.")
38
  self.model = smolagents.HfApiModel(
39
  max_tokens=32000,
40
  temperature=0.3,
 
43
  )
44
  self.tools = [smolagents.DuckDuckGoSearchTool(), smolagents.VisitWebpageTool(), smolagents.FinalAnswerTool()]
45
 
46
+ print("BasicAgent making search tool.")
47
  self.search_agent = smolagents.CodeAgent(
48
  name="search_agent",
49
  description="Search the web",
 
55
  additional_authorized_imports=["duckduckgo_search"],
56
  )
57
 
58
+ print("BasicAgent making manager.")
59
  self.manager_agent = smolagents.CodeAgent(
60
  name="manager_agent",
61
  description="Manger of other agents",
 
69
  )
70
 
71
  def __call__(self, question: str) -> str:
72
+ print(f"NEW Agent received question (first 50 chars): {question[:50]}...")
73
  prompt = f"{SYSTEM_PROMPT}\n\n{question}"
74
  answer = self.manager_agent.run(prompt)
75
+ print(f"NEW {answer=}")
76
  return answer