Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,45 @@ 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 simple_calculator(arg1:int, arg2:int)-> str: #it's import to specify the return type
|
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
+
from organisation_tools import PlanningTool
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
+
@tool
|
11 |
+
class PlanningToolWrapper:
|
12 |
+
"""A tool for managing and retrieving activities from a planning tool.
|
13 |
+
Args:
|
14 |
+
filename: The name of the JSON file to store the planning data.
|
15 |
+
activity: The activity to add.
|
16 |
+
timestamp: The timestamp for the activity.
|
17 |
+
date: The date to filter activities by.
|
18 |
+
month: The month to filter activities by.
|
19 |
+
year: The year to filter activities by.
|
20 |
+
"""
|
21 |
+
def __init__(self, filename: str = "planning_data.json"):
|
22 |
+
self.planning_tool = PlanningTool(filename)
|
23 |
+
|
24 |
+
def add_activity(self, activity: str, timestamp: str) -> str:
|
25 |
+
"""Adds an activity to the planning tool."""
|
26 |
+
return self.planning_tool.add_activity(activity, timestamp)
|
27 |
+
|
28 |
+
def get_activities(self) -> str:
|
29 |
+
"""Retrieves all activities from the planning tool."""
|
30 |
+
return self.planning_tool.get_activities()
|
31 |
+
|
32 |
+
def get_activities_by_date(self, date: str) -> str:
|
33 |
+
"""Retrieves activities by date from the planning tool."""
|
34 |
+
return self.planning_tool.get_activities_by_date(date)
|
35 |
+
|
36 |
+
def get_activities_by_month(self, month: str) -> str:
|
37 |
+
"""Retrieves activities by month from the planning tool."""
|
38 |
+
return self.planning_tool.get_activities_by_month(month)
|
39 |
+
|
40 |
+
def get_activities_by_year(self, year: str) -> str:
|
41 |
+
"""Retrieves activities by year from the planning tool."""
|
42 |
+
return self.planning_tool.get_activities_by_year(year)
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
47 |
@tool
|
48 |
def simple_calculator(arg1:int, arg2:int)-> str: #it's import to specify the return type
|