Spaces:
Paused
Paused
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
from smolagents import Tool
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
class VisitWebpageTool(Tool):
|
| 4 |
name = "visit_webpage"
|
| 5 |
description = (
|
|
@@ -38,4 +44,22 @@ class VisitWebpageTool(Tool):
|
|
| 38 |
except RequestException as e:
|
| 39 |
return f"Error fetching the webpage: {str(e)}"
|
| 40 |
except Exception as e:
|
| 41 |
-
return f"An unexpected error occurred: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from smolagents import Tool
|
| 2 |
|
| 3 |
+
###
|
| 4 |
+
from crewai_tools import BaseTool, ScrapeWebsiteTool, SerperDevTool
|
| 5 |
+
|
| 6 |
+
from datetime import date
|
| 7 |
+
###
|
| 8 |
+
|
| 9 |
class VisitWebpageTool(Tool):
|
| 10 |
name = "visit_webpage"
|
| 11 |
description = (
|
|
|
|
| 44 |
except RequestException as e:
|
| 45 |
return f"Error fetching the webpage: {str(e)}"
|
| 46 |
except Exception as e:
|
| 47 |
+
return f"An unexpected error occurred: {str(e)}"
|
| 48 |
+
|
| 49 |
+
###
|
| 50 |
+
class TodayTool(BaseTool):
|
| 51 |
+
name: str ="Today Tool"
|
| 52 |
+
description: str = ("Gets today's date.")
|
| 53 |
+
|
| 54 |
+
def _run(self) -> str:
|
| 55 |
+
return (str(date.today()))
|
| 56 |
+
|
| 57 |
+
def today_tool():
|
| 58 |
+
return TodayTool()
|
| 59 |
+
|
| 60 |
+
def search_tool():
|
| 61 |
+
return SerperDevTool()
|
| 62 |
+
|
| 63 |
+
def scrape_tool():
|
| 64 |
+
return ScrapeWebsiteTool()
|
| 65 |
+
###
|