felixmanojh commited on
Commit
0e7e689
·
verified ·
1 Parent(s): e8d4494

Update app.py

Browse files

Added code for Duckduckgo search for Top 5 news results if given a location

Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -18,6 +18,19 @@ def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
 
18
  """
19
  return "What magic will you build ?"
20
 
21
+ @tool
22
+ def searchNews(location:str)-> str: #it's import to specify the return type
23
+ #Keep this format for the description / args / args description but feel free to modify the tool
24
+ """A tool that searches for the Top news
25
+ Args:
26
+ location: Location of the place for which the top news has to be retrieved
27
+ """
28
+ query = f"top news {location}"
29
+ ddg_tool = DuckDuckGoSearchTool(query,5)
30
+
31
+ results = ddg_tool.search()
32
+ return results
33
+
34
  @tool
35
  def get_current_time_in_timezone(timezone: str) -> str:
36
  """A tool that fetches the current local time in a specified timezone.