JorgeVeramendi commited on
Commit
bb7de8c
·
verified ·
1 Parent(s): a533980

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -19,19 +19,19 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
19
  return "What magic will you build ?"
20
 
21
  @tool
22
- def get_current_time_in_timezone(area: str) -> str:
23
- """A tool that fetches the current local time in a specified area.
24
  Args:
25
- area: A string representing a valid area.
26
  """
27
  try:
28
- # Create area object
29
- tz = pytz.timezone(area)
30
- # Get current time in that area
31
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
32
- return f"The current local time in {area} is: {local_time}"
33
  except Exception as e:
34
- return f"Error fetching time for area '{area}': {str(e)}"
35
 
36
 
37
  final_answer = FinalAnswerTool()
 
19
  return "What magic will you build ?"
20
 
21
  @tool
22
+ def get_current_time_in_timezone(timezone: str) -> str:
23
+ """A tool that fetches the current local time in a specified timezone.
24
  Args:
25
+ timezone: A string representing a valid timezone (e.g., 'America/New_York').
26
  """
27
  try:
28
+ # Create timezone object
29
+ tz = pytz.timezone(timezone)
30
+ # Get current time in that timezone
31
  local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
32
+ return f"The current local time in {timezone} is: {local_time}"
33
  except Exception as e:
34
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
 
37
  final_answer = FinalAnswerTool()