pedrogaprieto commited on
Commit
0cd4295
·
verified ·
1 Parent(s): a8837ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -3,15 +3,17 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
6
- from smolagents import ToolCallingAgent, LiteLLMModel, DuckDuckGoSearchTool
7
 
8
  # (Keep Constants as is)
9
  # --- Constants ---
10
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
11
 
12
 
13
- # tools to use
14
- search_tool = DuckDuckGoSearchTool()
 
 
15
 
16
  # Initialize the watsonx model
17
  llm = LiteLLMModel(
@@ -21,11 +23,18 @@ llm = LiteLLMModel(
21
  num_ctx=8162
22
  )
23
 
24
- # --- Basic Agent Definition ---
25
- # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
26
 
27
- agent = ToolCallingAgent(tools=[search_tool], model=llm)
 
 
 
 
 
 
28
 
 
 
 
29
  class BasicAgent:
30
  def __init__(self):
31
  print("BasicAgent initialized.")
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ from smolagents import CodeAgent, LiteLLMModel, DuckDuckGoSearchTool
7
 
8
  # (Keep Constants as is)
9
  # --- Constants ---
10
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
11
 
12
 
13
+ # import custom tools to use
14
+ from tools import SerperSearchTool
15
+
16
+ search_tool = SerperSearchTool()
17
 
18
  # Initialize the watsonx model
19
  llm = LiteLLMModel(
 
23
  num_ctx=8162
24
  )
25
 
 
 
26
 
27
+ # Create Alfred with all the tools
28
+ agent = CodeAgent(
29
+ tools=[search_tool],
30
+ model=llm,
31
+ add_base_tools=True, # Add any additional base tools
32
+ planning_interval=3 # Enable planning every 3 steps
33
+ )
34
 
35
+ #agent = ToolCallingAgent(tools=[search_tool], model=llm)
36
+
37
+ # --- Basic Agent Definition ---
38
  class BasicAgent:
39
  def __init__(self):
40
  print("BasicAgent initialized.")