wishmi1234 commited on
Commit
75c6826
·
verified ·
1 Parent(s): 2f0fa1d

Update tools.py

Browse files

Added latest_news_tool

Files changed (1) hide show
  1. tools.py +22 -0
tools.py CHANGED
@@ -110,3 +110,25 @@ hub_stats_tool = HubStatsTool()
110
 
111
  # Example usage
112
  print(hub_stats_tool("facebook")) # Example: Get the most downloaded model by Facebook
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  # Example usage
112
  print(hub_stats_tool("facebook")) # Example: Get the most downloaded model by Facebook
113
+
114
+
115
+
116
+ class LatestNewsTool(Tool):
117
+ name = "latest_news_tool"
118
+ description = "Fetches the latest news related to a specific topic using DuckDuckGoSearchTool"
119
+ inputs = {
120
+ "topic":{
121
+ "type":"string",
122
+ "description":"The topic for which the latest news is needed"
123
+ }
124
+ }
125
+ output_type = "string"
126
+
127
+ def __init__(self):
128
+ self.search_tool = DuckDuckGoSearchTool()
129
+
130
+ def forward(self, topic: str):
131
+ results = self.search_tool.forward(f"{topic} latest news")
132
+ return results
133
+
134
+