lpessoa commited on
Commit
38e4304
·
verified ·
1 Parent(s): 747907b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -33,6 +33,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  final_answer = FinalAnswerTool()
38
 
@@ -57,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
57
 
58
  agent = CodeAgent(
59
  model=model,
60
- tools=[final_answer, web_search],
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,
 
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
+ @tool
37
+ def calculate_distance(latitude1: float, longitude1: float, latitude2: float, longitude2: float) -> float:
38
+ """Calculate the geodesic distance in kilometers between two points given their coordinates (latitude and longitude).
39
+ Args:
40
+ latitude1: Latitude of the first point.
41
+ longitude1: Longitude of the first point.
42
+ latitude2: Latitude of the second point.
43
+ longitude2: Longitude of the second point.
44
+ Returns:
45
+ float: Distance in kilometers.
46
+ """
47
+ from geopy import distance
48
+ return distance.distance((latitude1, longitude1), (latitude2, longitude2)).km
49
 
50
  final_answer = FinalAnswerTool()
51
 
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer, web_search, calculate_distance],
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,