m-ric HF staff commited on
Commit
3366410
·
verified ·
1 Parent(s): 042710c

Upload tool

Browse files
Files changed (1) hide show
  1. tool.py +2 -0
tool.py CHANGED
@@ -30,6 +30,8 @@ class SimpleTool(Tool):
30
  mode=transportation_mode,
31
  departure_time=datetime(2025, 12, 6, 11, 0), # At 11, date far in the future
32
  )
 
 
33
  return directions_result[0]["legs"][0]["duration"]["text"]
34
  except Exception as e:
35
  print(e)
 
30
  mode=transportation_mode,
31
  departure_time=datetime(2025, 12, 6, 11, 0), # At 11, date far in the future
32
  )
33
+ if len(directions_result) == 0:
34
+ return "No way found between these places with the required transportation mode."
35
  return directions_result[0]["legs"][0]["duration"]["text"]
36
  except Exception as e:
37
  print(e)