m-ric HF staff commited on
Commit
26ec7eb
·
verified ·
1 Parent(s): 39c4b99

Update tool.py

Browse files
Files changed (1) hide show
  1. tool.py +3 -3
tool.py CHANGED
@@ -4,7 +4,7 @@ from typing import Optional
4
  class SimpleTool(Tool):
5
  name = "get_travel_duration"
6
  description = "Gets the travel time in car between two places."
7
- inputs = {"start_location":{"type":"string","description":"the place from which you start your ride"},"destination_location":{"type":"string","description":"the place of arrival"},"transportation_mode":{"type":"string","nullable":True,"description":"The transportation mode, in 'driving', 'walking', 'bicycling', or 'transit'."}}
8
  output_type = "string"
9
 
10
  def forward(self, start_location: str, destination_location: str, transportation_mode: Optional[str] = None) -> str:
@@ -13,14 +13,14 @@ class SimpleTool(Tool):
13
  Args:
14
  start_location: the place from which you start your ride
15
  destination_location: the place of arrival
16
- transportation_mode: The transportation mode, in 'driving', 'walking', 'bicycling', or 'transit'.
17
  """
18
  import googlemaps
19
  import os
20
  from datetime import datetime
21
  gmaps = googlemaps.Client(os.getenv("GMAPS_API_KEY"))
22
  if transportation_mode is None:
23
- transportation_mode = "transit"
24
  try:
25
  directions_result = gmaps.directions(
26
  start_location,
 
4
  class SimpleTool(Tool):
5
  name = "get_travel_duration"
6
  description = "Gets the travel time in car between two places."
7
+ inputs = {"start_location":{"type":"string","description":"the place from which you start your ride"},"destination_location":{"type":"string","description":"the place of arrival"},"transportation_mode":{"type":"string","nullable":True,"description":"The transportation mode, in 'driving', 'walking', 'bicycling', or 'transit'. Defaults to 'driving'."}}
8
  output_type = "string"
9
 
10
  def forward(self, start_location: str, destination_location: str, transportation_mode: Optional[str] = None) -> str:
 
13
  Args:
14
  start_location: the place from which you start your ride
15
  destination_location: the place of arrival
16
+ transportation_mode: The transportation mode, in 'driving', 'walking', 'bicycling', or 'transit'. Defaults to 'driving'.
17
  """
18
  import googlemaps
19
  import os
20
  from datetime import datetime
21
  gmaps = googlemaps.Client(os.getenv("GMAPS_API_KEY"))
22
  if transportation_mode is None:
23
+ transportation_mode = "driving"
24
  try:
25
  directions_result = gmaps.directions(
26
  start_location,