fmcurti commited on
Commit
779dad2
·
1 Parent(s): 81917a3
Files changed (2) hide show
  1. app.py +6 -1
  2. requirements.txt +3 -1
app.py CHANGED
@@ -3,6 +3,8 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
 
 
6
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
@@ -12,10 +14,13 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
  class BasicAgent:
14
  def __init__(self):
 
 
 
15
  print("BasicAgent initialized.")
16
  def __call__(self, question: str) -> str:
17
  print(f"Agent received question (first 50 chars): {question[:50]}...")
18
- fixed_answer = "This is a default answer."
19
  print(f"Agent returning fixed answer: {fixed_answer}")
20
  return fixed_answer
21
 
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel, VisitWebpageTool, WikipediaSearchTool,PythonInterpreterTool
7
+
8
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
 
14
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  class BasicAgent:
16
  def __init__(self):
17
+ model = InferenceClientModel(model_id="microsoft/Phi-4-reasoning")
18
+ tools = [DuckDuckGoSearchTool(), VisitWebpageTool(), WikipediaSearchTool(), PythonInterpreterTool()]
19
+ self.agent = CodeAgent(tools=tools, model=model, max_steps=10, add_base_tools=True)
20
  print("BasicAgent initialized.")
21
  def __call__(self, question: str) -> str:
22
  print(f"Agent received question (first 50 chars): {question[:50]}...")
23
+ fixed_answer = self.agent.run(question)
24
  print(f"Agent returning fixed answer: {fixed_answer}")
25
  return fixed_answer
26
 
requirements.txt CHANGED
@@ -1,2 +1,4 @@
1
  gradio
2
- requests
 
 
 
1
  gradio
2
+ requests
3
+ smolagents
4
+ duckduckgo-search