SimoElb commited on
Commit
f4d48f4
·
verified ·
1 Parent(s): 970052a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -46,7 +46,23 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
46
  custom_role_conversions=None,
47
  )
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
 
50
  # Import tool from Hub
51
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
52
 
@@ -55,7 +71,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
46
  custom_role_conversions=None,
47
  )
48
 
49
+ @tool
50
+ def get_timezone_in_country(country: str) -> str:
51
+ """A tool that fetches the current timezone in a specified country.
52
+ Args:
53
+ country: A string representing a country name (e.g., 'France').
54
+ """
55
+ try:
56
+ # Create timezone object
57
+ tz = pytz.timezone(timezone)
58
+ # Get current time in that timezone
59
+ local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
60
+ return f"The current local time in {timezone} is: {local_time}"
61
+ except Exception as e:
62
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"
63
+
64
 
65
+
66
  # Import tool from Hub
67
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
68
 
 
71
 
72
  agent = CodeAgent(
73
  model=model,
74
+ tools=[get_current_time_in_timezone, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
75
  max_steps=6,
76
  verbosity_level=1,
77
  grammar=None,