menaahmed22 commited on
Commit
e52c708
·
verified ·
1 Parent(s): d306029

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -17,10 +17,16 @@ class BasicAgent:
17
  print("BasicAgent initialized.")
18
  def __call__(self, question: str) -> str:
19
  print(f"Agent received question (first 50 chars): {question[:50]}...")
20
- fixed_answer = "This is a default answer."
21
- print(f"Agent returning fixed answer: {fixed_answer}")
22
- return fixed_answer
23
-
 
 
 
 
 
 
24
  def run_and_submit_all( profile: gr.OAuthProfile | None):
25
  """
26
  Fetches all questions, runs the BasicAgent on them, submits all answers,
 
17
  print("BasicAgent initialized.")
18
  def __call__(self, question: str) -> str:
19
  print(f"Agent received question (first 50 chars): {question[:50]}...")
20
+ try:
21
+ model = model=HfApiModel() )
22
+ agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model, add_base_tools=True)
23
+ agent_response = agent.run(question)
24
+ except Exception as e:
25
+ print(f"Error running agent: {e}")
26
+ return f"AGENT ERROR: {e}"
27
+
28
+ print(f"Agent returning answer: {agent_response}")
29
+ return agent_response
30
  def run_and_submit_all( profile: gr.OAuthProfile | None):
31
  """
32
  Fetches all questions, runs the BasicAgent on them, submits all answers,