Spaces:
Build error
Build error
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -1,11 +1,25 @@
|
|
| 1 |
-
from
|
| 2 |
from smolagents import Tool
|
| 3 |
import random
|
| 4 |
from huggingface_hub import list_models
|
| 5 |
|
| 6 |
|
| 7 |
# Initialize the DuckDuckGo search tool
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
class WeatherInfoTool(Tool):
|
|
|
|
| 1 |
+
from smolagents import DuckDuckGoSearchTool
|
| 2 |
from smolagents import Tool
|
| 3 |
import random
|
| 4 |
from huggingface_hub import list_models
|
| 5 |
|
| 6 |
|
| 7 |
# Initialize the DuckDuckGo search tool
|
| 8 |
+
class InternetSearchTool(Tool):
|
| 9 |
+
name = "internet_search"
|
| 10 |
+
description = "Searches the internet for the answer to any question input. Returns a long batch of textual information related to the query."
|
| 11 |
+
inputs = {
|
| 12 |
+
"question": {
|
| 13 |
+
"type": "string",
|
| 14 |
+
"description": "The question to retrieve an answer for."
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
output_type = "string"
|
| 18 |
+
|
| 19 |
+
def forward(self, question: str):
|
| 20 |
+
search_tool = DuckDuckGoSearchTool()
|
| 21 |
+
result = search_tool(question)
|
| 22 |
+
return result
|
| 23 |
|
| 24 |
|
| 25 |
class WeatherInfoTool(Tool):
|