theothecat commited on
Commit
6b7e39b
·
verified ·
1 Parent(s): a8b8435

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -29,7 +29,23 @@ def get_current_time_in_timezone(timezone: str) -> str:
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
 
@@ -56,7 +72,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
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 original tool {timezone} is: {local_time}"
33
+ except Exception as e:
34
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
+
36
+
37
+ @tool
38
+ def get_current_time_in_timezone_test_which_is_called(timezone: str) -> str:
39
+ """A tool that fetches the current local time in a specified timezone.
40
+ Args:
41
+ timezone: A string representing a valid timezone (e.g., 'America/New_York').
42
+ """
43
+ try:
44
+ # Create timezone object
45
+ tz = pytz.timezone(timezone)
46
+ # Get current time in that timezone
47
+ local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
48
+ return f"The current local time in duplicate tool{timezone} is: {local_time}"
49
  except Exception as e:
50
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
51
 
 
72
 
73
  agent = CodeAgent(
74
  model=model,
75
+ tools=[final_answer, get_current_time_in_timezone, get_current_time_in_timezone_test_which_is_called], ## add your tools here (don't remove final answer)
76
  max_steps=6,
77
  verbosity_level=1,
78
  grammar=None,