9jini commited on
Commit
bbcc589
·
verified ·
1 Parent(s): d3055b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -4,7 +4,7 @@ import requests
4
  import inspect
5
  import pandas as pd
6
 
7
- from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel, WikipediaSearchTool
8
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
@@ -14,21 +14,19 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  class BasicAgent:
16
  def __init__(self):
17
- model = OpenAIServerModel(model_id="deepseek-chat",api_key="sk-04da63f756c9468182d278f52e33ad15", api_base="https://api.deepseek.com")
18
-
19
- search_tool = DuckDuckGoSearchTool()
20
- wiki_search = WikipediaSearchTool()
21
 
 
 
 
22
  self.agent = CodeAgent(
23
- model = model,
24
- tools=[
25
- search_tool,
26
- wiki_search,
27
- ]
28
  )
29
-
30
  def __call__(self, question: str) -> str:
31
- return self.agent.run(question) # type: ignore
 
32
 
33
  def run_and_submit_all( profile: gr.OAuthProfile | None):
34
  """
 
4
  import inspect
5
  import pandas as pd
6
 
7
+ from smolagents import LiteLLMModel, DuckDuckGoSearchTool, CodeAgent, WikipediaSearchTool
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
 
18
+ model = LiteLLMModel(
19
+ model_id="gemini/gemini-2.5-flash-preview-04-17",
20
+ )
21
  self.agent = CodeAgent(
22
+ model=model,
23
+ tools=[DuckDuckGoSearchTool(), WikipediaSearchTool()],
24
+ add_base_tools=True,
 
 
25
  )
26
+ print("BasicAgent initialized.")
27
  def __call__(self, question: str) -> str:
28
+ answer = self.agent.run(question)
29
+ return answer
30
 
31
  def run_and_submit_all( profile: gr.OAuthProfile | None):
32
  """