Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,15 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import ToolCallingAgent, LiteLLMModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Initialize the watsonx model
|
| 9 |
llm = LiteLLMModel(
|
|
@@ -13,14 +21,10 @@ llm = LiteLLMModel(
|
|
| 13 |
num_ctx=8162
|
| 14 |
)
|
| 15 |
|
| 16 |
-
# (Keep Constants as is)
|
| 17 |
-
# --- Constants ---
|
| 18 |
-
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 19 |
-
|
| 20 |
# --- Basic Agent Definition ---
|
| 21 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 22 |
|
| 23 |
-
agent = ToolCallingAgent(tools=[], model=llm)
|
| 24 |
|
| 25 |
class BasicAgent:
|
| 26 |
def __init__(self):
|
|
|
|
| 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 |
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):
|