Saketh1121 commited on
Commit
5f632ce
·
verified ·
1 Parent(s): 1a5ed5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -15,9 +15,12 @@ def get_weather(city:str)-> str: #it's import to specify the return type
15
  Args:
16
  city: Name of the city
17
  """
18
- search = DuckDuckGoSearchTool()
19
- result = search("Weather in " + city)
20
- return f"Weather in {city} is {result}"
 
 
 
21
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
 
15
  Args:
16
  city: Name of the city
17
  """
18
+ try:
19
+ search = DuckDuckGoSearchTool()
20
+ result = search("Weather in " + city)
21
+ return f"Weather in {city} is {result}"
22
+ except Exception as e:
23
+ return f"Error fetching weather for {city}: {str(e)}"
24
 
25
  @tool
26
  def get_current_time_in_timezone(timezone: str) -> str: