cjb97 commited on
Commit
59f4a4b
·
1 Parent(s): ad70909

updated package versions

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -1
  2. tools/weather.py +2 -2
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  smolagents==1.9.2
2
- gradio==4.44.1
3
  pyyaml
4
  pytz
5
  requests
 
1
  smolagents==1.9.2
2
+ gradio
3
  pyyaml
4
  pytz
5
  requests
tools/weather.py CHANGED
@@ -22,14 +22,14 @@ class WeatherTool(Tool):
22
  Get the current weather for a specified location.
23
 
24
  Args:
25
- location: A string representing a city or location (e.g., 'New York', 'Paris, France').
26
 
27
  Returns:
28
  A string with the current weather information.
29
  """
30
  # Validate that location contains only allowed characters: letters, digits, spaces, and hyphens
31
  if not re.fullmatch(r'[A-Za-z0-9\s-]+', location):
32
- return "Error: Location contains invalid characters. Only letters, digits, spaces, and hyphens are allowed."
33
  try:
34
  # Get the API key from environment variables
35
  api_key = os.getenv('OPENWEATHERMAP_API_KEY')
 
22
  Get the current weather for a specified location.
23
 
24
  Args:
25
+ location: A string representing a city (e.g., 'New York', 'Paris').
26
 
27
  Returns:
28
  A string with the current weather information.
29
  """
30
  # Validate that location contains only allowed characters: letters, digits, spaces, and hyphens
31
  if not re.fullmatch(r'[A-Za-z0-9\s-]+', location):
32
+ return "Error: Location contains invalid characters. Only letters, digits, spaces, and hyphens are allowed. I cannot disambiguate between cities with the same name."
33
  try:
34
  # Get the API key from environment variables
35
  api_key = os.getenv('OPENWEATHERMAP_API_KEY')