Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -12,25 +12,28 @@ search_tool = DuckDuckGoSearchTool()
12
  search_tool = DuckDuckGoSearchTool()
13
 
14
 
 
 
 
15
  @tool
16
  def get_top_places(city: str, category: str = "places", n: int = 5) -> list:
17
  """
18
  Get the top N places for a given category in a specified city.
19
 
20
- Parameters:
21
  city (str): The name of the city to search for.
22
  category (str): The category to search (e.g., "places", "food", "museum"). Default is "places".
23
  n (int): The number of results to return. Default is 5, maximum 100.
24
 
25
  Returns:
26
- list: A list of strings containing the title and URL for each result.
27
 
28
  Raises:
29
  ValueError: If the category is not one of "places", "food", or "museum".
30
 
31
  Example:
32
  >>> get_top_places("Paris", "food", 5)
33
- ['Le Meurice - https://example.com', 'L'Ambroisie - https://example.com']
34
  """
35
  valid_categories = ["places", "food", "museum"]
36
  if category not in valid_categories:
@@ -78,7 +81,7 @@ with open("prompts.yaml", 'r') as stream:
78
 
79
  agent = CodeAgent(
80
  model=model,
81
- tools=[final_answer,get_top_places], ## add your tools here (don't remove final answer)
82
  max_steps=6,
83
  verbosity_level=1,
84
  grammar=None,
 
12
  search_tool = DuckDuckGoSearchTool()
13
 
14
 
15
+ # Initialize the DuckDuckGo search tool (only one instance is needed)
16
+ search_tool = DuckDuckGoSearchTool()
17
+
18
  @tool
19
  def get_top_places(city: str, category: str = "places", n: int = 5) -> list:
20
  """
21
  Get the top N places for a given category in a specified city.
22
 
23
+ Args:
24
  city (str): The name of the city to search for.
25
  category (str): The category to search (e.g., "places", "food", "museum"). Default is "places".
26
  n (int): The number of results to return. Default is 5, maximum 100.
27
 
28
  Returns:
29
+ list: A list of strings, each containing the title and URL for a result.
30
 
31
  Raises:
32
  ValueError: If the category is not one of "places", "food", or "museum".
33
 
34
  Example:
35
  >>> get_top_places("Paris", "food", 5)
36
+ ['Le Meurice - https://example.com', "L'Ambroisie - https://example.com"]
37
  """
38
  valid_categories = ["places", "food", "museum"]
39
  if category not in valid_categories:
 
81
 
82
  agent = CodeAgent(
83
  model=model,
84
+ tools=[final_answer,get_top_places,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
85
  max_steps=6,
86
  verbosity_level=1,
87
  grammar=None,