Khaled Jamal commited on
Commit
5755710
·
1 Parent(s): 0c10235

removed the tool to fetch current local time by time zone

Browse files
Files changed (1) hide show
  1. app.py +1 -15
app.py CHANGED
@@ -4,8 +4,6 @@
4
  from smolagents import CodeAgent, HfApiModel, load_tool, tool
5
 
6
  # Standard library imports
7
- import datetime
8
- import pytz
9
  import yaml
10
 
11
  # External imports
@@ -61,19 +59,7 @@ def simple_sentiment_tool(text: str) -> str:
61
  score = "0.99"
62
 
63
  return f"Sentiment: {label} (confidence: {score:.4f})"
64
-
65
- @tool
66
- def get_current_time_in_timezone(timezone: str) -> str:
67
- """A tool that fetches the current local time in a specified timezone.
68
- Args:
69
- timezone: A string representing a valid timezone (e.g., 'America/New_York').
70
- """
71
- try:
72
- tz = pytz.timezone(timezone)
73
- local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
74
- return f"The current local time in {timezone} is: {local_time}"
75
- except Exception as e:
76
- return f"Error fetching time for timezone '{timezone}': {str(e)}"
77
 
78
  # Final answer tool
79
  final_answer = FinalAnswerTool()
 
4
  from smolagents import CodeAgent, HfApiModel, load_tool, tool
5
 
6
  # Standard library imports
 
 
7
  import yaml
8
 
9
  # External imports
 
59
  score = "0.99"
60
 
61
  return f"Sentiment: {label} (confidence: {score:.4f})"
62
+
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  # Final answer tool
65
  final_answer = FinalAnswerTool()