diegocp01 commited on
Commit
acc27c6
·
verified ·
1 Parent(s): ae7a494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -8
app.py CHANGED
@@ -4,19 +4,30 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
-
8
  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 my_custom_tool(arg1:str, arg2: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 does nothing yet
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
 
 
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from datetime import datetime, timedelta
8
  from Gradio_UI import GradioUI
9
 
10
+ # Below is the new deadline calculator tool
11
  @tool
12
+ def deadline_calculator(start_date: str, days: int) -> dict:
13
+ """A tool that calculates the deadline date based on a start date and a number of days.
 
14
  Args:
15
+ start_date: The starting date in 'YYYY-MM-DD' format.
16
+ days: The number of days until the deadline.
17
+ Returns:
18
+ A dictionary containing the deadline date and the day of the week.
19
  """
20
+ try:
21
+ start = datetime.strptime(start_date, "%Y-%m-%d")
22
+ deadline = start + timedelta(days=days)
23
+ weekday = deadline.strftime("%A")
24
+ return {"Deadline": deadline.strftime("%Y-%m-%d"), "Day of Week": weekday}
25
+ except ValueError:
26
+ return {"Error": "Invalid date format. Please use 'YYYY-MM-DD'."}
27
+
28
+ # Example usage:
29
+ # print(deadline_calculator("2025-02-18", 10))
30
+
31
 
32
  @tool
33
  def get_current_time_in_timezone(timezone: str) -> str: