ChrisNguyen05 commited on
Commit
622ce57
·
verified ·
1 Parent(s): 534b80c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -4,18 +4,23 @@ import requests
4
  import inspect
5
  import pandas as pd
6
 
 
 
 
 
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
9
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
10
 
11
- # --- Basic Agent Definition ---
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
 
 
4
  import inspect
5
  import pandas as pd
6
 
7
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, FinalAnswerTool, LiteLLMModel
8
+
9
+
10
+ model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-lite", api_key=os.getenv('GEMINI_API_KEY'))
11
+
12
  # (Keep Constants as is)
13
  # --- Constants ---
14
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
15
 
16
+
 
17
  class BasicAgent:
18
  def __init__(self):
19
  print("BasicAgent initialized.")
20
+ self.agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
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