Vijayashankar commited on
Commit
cf3af55
·
verified ·
1 Parent(s): 08d7e88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -9,13 +9,21 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def find_US_president_in_year(arg1:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that finds the Presidnet of USA in a spercified year
15
- Args:
16
- arg1: int represents the year in which a US citizen is a President of the USA
17
- """
18
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
19
 
20
  @tool
21
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -54,7 +62,7 @@ with open("prompts.yaml", 'r') as stream:
54
 
55
  agent = CodeAgent(
56
  model=model,
57
- tools=[get_current_time_in_timezone,final_answer], ## add your tools here (don't remove final answer)
58
  max_steps=6,
59
  verbosity_level=1,
60
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def calculate_walking_time_paris(start, end):
13
+ # This is a placeholder function. In a real scenario, this function would call a tool to get the actual walking time.
14
+ # For now, we'll use predefined walking times for simplicity.
15
+ walking_times = {
16
+ ("Eiffel Tower", "Champ de Mars"): 9,
17
+ ("Champ de Mars", "Musée de l'Orangerie"): 11,
18
+ ("Musée de l'Orangerie", "Pont Alexandre III"): 8,
19
+ ("Pont Alexandre III", "Grand Palais"): 12,
20
+ ("Grand Palais", "Jardins du Trocadéro"): 10,
21
+ ("Jardins du Trocadéro", "Eiffel Tower"): 10,
22
+ ("Eiffel Tower", "Musée Rodin"): 18,
23
+ ("Musée Rodin", "Pont de l'Alma"): 7,
24
+ ("Pont de l'Alma", "Basilique du Sacré-Cœur"): 13
25
+ }
26
+ return walking_times.get((start, end), 20)
27
 
28
  @tool
29
  def get_current_time_in_timezone(timezone: str) -> str:
 
62
 
63
  agent = CodeAgent(
64
  model=model,
65
+ tools=[get_current_time_in_timezone,calculate_walking_time_paris,final_answer], ## add your tools here (don't remove final answer)
66
  max_steps=6,
67
  verbosity_level=1,
68
  grammar=None,