vitpolis commited on
Commit
316407f
·
verified ·
1 Parent(s): 5ae3b98

Update app.py

Browse files

Add google trends tool

Files changed (1) hide show
  1. app.py +41 -1
app.py CHANGED
@@ -8,6 +8,46 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  @tool
12
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
@@ -55,7 +95,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer, image_generation_tool, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
+ # https://trends.google.com/trending
12
+ @tool
13
+ def fomo_buster(country: str) -> str:
14
+ """
15
+ Get 5 top google trends in the given Country from URL https://trends.google.com/trending
16
+
17
+ Args:
18
+ country: Target country for trends
19
+
20
+ Returns:
21
+ str: List of the 5 trends in the given country.
22
+ """
23
+ # Initialize DuckDuckGoSearch
24
+ duck_tool = DuckDuckGoSearchTool()
25
+ today = datetime.date.today().strftime("%Y-%m-%d") # Format the date explicitly
26
+ query = f"{country} {today}"
27
+ results = duck_tool(query)
28
+
29
+ return f"{today} list of trends in {country}: {results}"
30
+
31
+ @tool
32
+ def fomo_buster(news_category: str, country: str) -> str:
33
+ """
34
+ Create summary of the 5 latest news insights based on category and country using DuckDuckGoSearch. Communication like in newspaper. Provide URL to the sources.
35
+
36
+ Args:
37
+ news_category: Category of news (e.g., 'technology', 'politics', 'sports')
38
+ country: Target country for news
39
+
40
+ Returns:
41
+ str: Summary of the 5 insights on given category and country.
42
+ """
43
+ # Initialize DuckDuckGoSearch
44
+ duck_tool = DuckDuckGoSearchTool()
45
+ today = datetime.date.today().strftime("%Y-%m-%d") # Format the date explicitly
46
+ query = f"{news_category} news {country} {today}"
47
+ results = duck_tool(query)
48
+
49
+ return f"{today} summary in {country}: {results} summary of the category {news_category}"
50
+
51
  @tool
52
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
53
  #Keep this format for the description / args / args description but feel free to modify the tool
 
95
 
96
  agent = CodeAgent(
97
  model=model,
98
+ tools=[final_answer, image_generation_tool, get_current_time_in_timezone, fomo_buster], ## add your tools here (don't remove final answer)
99
  max_steps=6,
100
  verbosity_level=1,
101
  grammar=None,