clintonvanry commited on
Commit
e311a66
·
verified ·
1 Parent(s): a0d588f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -19,9 +19,9 @@ def get_weather(city: str) -> str: # Fixed comment syntax and function name
19
  str: Weather information for the specified city, or error message
20
  """
21
  try:
22
- # Initialize the search tool
23
- DuckDuckGoSearchTool.setup()
24
- web_search_tool = DuckDuckGoSearchTool(max_results=3, rate_limit=2.0) # Get more results for better info
25
 
26
  # Search for weather information
27
  search_query = f"current weather {city} temperature conditions"
@@ -54,6 +54,8 @@ def get_weather(city: str) -> str: # Fixed comment syntax and function name
54
  return f"Error fetching weather information for city '{city}': {str(e)}"
55
 
56
 
 
 
57
  @tool
58
  def get_current_time_in_timezone(timezone: str) -> str:
59
  """A tool that fetches the current local time in a specified timezone.
 
19
  str: Weather information for the specified city, or error message
20
  """
21
  try:
22
+ # Initialize the search tool correctly
23
+ web_search_tool = DuckDuckGoSearchTool(max_results=3, rate_limit=2.0)
24
+ web_search_tool.setup() # Call setup on the instance, not the class
25
 
26
  # Search for weather information
27
  search_query = f"current weather {city} temperature conditions"
 
54
  return f"Error fetching weather information for city '{city}': {str(e)}"
55
 
56
 
57
+
58
+
59
  @tool
60
  def get_current_time_in_timezone(timezone: str) -> str:
61
  """A tool that fetches the current local time in a specified timezone.