Spaces:
Sleeping
Sleeping
Added wikipedia search tool
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import requests
|
|
| 3 |
import pandas as pd
|
| 4 |
import gradio as gr
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel
|
| 7 |
|
| 8 |
load_dotenv()
|
| 9 |
|
|
@@ -16,14 +16,13 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
print("BasicAgent initialized.")
|
| 19 |
-
search_tool = DuckDuckGoSearchTool()
|
| 20 |
model = InferenceClientModel(
|
| 21 |
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 22 |
token=os.getenv("HF_TOKEN"),
|
| 23 |
)
|
| 24 |
self.agent = CodeAgent(
|
| 25 |
model=model,
|
| 26 |
-
tools=[
|
| 27 |
)
|
| 28 |
def __call__(self, question: str) -> str:
|
| 29 |
# print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import gradio as gr
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel, WikipediaSearchTool
|
| 7 |
|
| 8 |
load_dotenv()
|
| 9 |
|
|
|
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
print("BasicAgent initialized.")
|
|
|
|
| 19 |
model = InferenceClientModel(
|
| 20 |
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 21 |
token=os.getenv("HF_TOKEN"),
|
| 22 |
)
|
| 23 |
self.agent = CodeAgent(
|
| 24 |
model=model,
|
| 25 |
+
tools=[DuckDuckGoSearchTool(), WikipediaSearchTool()],
|
| 26 |
)
|
| 27 |
def __call__(self, question: str) -> str:
|
| 28 |
# print(f"Agent received question (first 50 chars): {question[:50]}...")
|