Spaces:
Sleeping
Sleeping
Update tools/weather.py
Browse files- tools/weather.py +2 -3
tools/weather.py
CHANGED
|
@@ -13,8 +13,8 @@ class WeatherForecast(Tool):
|
|
| 13 |
def __init__(self, max_results=10, **kwargs):
|
| 14 |
super().__init__()
|
| 15 |
|
| 16 |
-
def forward(self) -> str:
|
| 17 |
-
results = self.get_weather_forecast()
|
| 18 |
if len(results) == 0:
|
| 19 |
raise Exception("No results found! Try a less restrictive/shorter query.")
|
| 20 |
postprocessed_results = [f"[{result['title']}]({result['href']})\n{result['body']}" for result in results]
|
|
@@ -88,4 +88,3 @@ class WeatherForecast(Tool):
|
|
| 88 |
except (KeyError, IndexError, ValueError) as e: # Handle more potential errors
|
| 89 |
print(f"Error parsing geocoding response: {e}")
|
| 90 |
return None, None
|
| 91 |
-
|
|
|
|
| 13 |
def __init__(self, max_results=10, **kwargs):
|
| 14 |
super().__init__()
|
| 15 |
|
| 16 |
+
def forward(self, city) -> str:
|
| 17 |
+
results = self.get_weather_forecast(city)
|
| 18 |
if len(results) == 0:
|
| 19 |
raise Exception("No results found! Try a less restrictive/shorter query.")
|
| 20 |
postprocessed_results = [f"[{result['title']}]({result['href']})\n{result['body']}" for result in results]
|
|
|
|
| 88 |
except (KeyError, IndexError, ValueError) as e: # Handle more potential errors
|
| 89 |
print(f"Error parsing geocoding response: {e}")
|
| 90 |
return None, None
|
|
|