Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,32 @@ 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
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
"""A tool that searchs the web to respond the question asked
|
| 15 |
Args:
|
| 16 |
query: the question asked by user that we can search the web for.
|
|
@@ -57,7 +76,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[final_answer, get_current_time_in_timezone,image_generation_tool,search_web], ## add your tools here (don't remove final answer)
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from todoist_api_python.api import TodoistAPI
|
| 8 |
+
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
| 14 |
+
def show_to_do_list(token:str)-> str:
|
| 15 |
+
"""A tool that shows all the taks available in todoist account
|
| 16 |
+
Args:
|
| 17 |
+
token: the token for the account of user that we want to show the tasks.
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
api = TodoistAPI(token)
|
| 21 |
+
|
| 22 |
+
try:
|
| 23 |
+
projects = api.get_projects()
|
| 24 |
+
print(projects)
|
| 25 |
+
except Exception as error:
|
| 26 |
+
print(error)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
@tool
|
| 31 |
+
def search_web(query:str)-> str:
|
| 32 |
+
|
| 33 |
"""A tool that searchs the web to respond the question asked
|
| 34 |
Args:
|
| 35 |
query: the question asked by user that we can search the web for.
|
|
|
|
| 76 |
|
| 77 |
agent = CodeAgent(
|
| 78 |
model=model,
|
| 79 |
+
tools=[final_answer, get_current_time_in_timezone,image_generation_tool,search_web,show_to_do_list], ## add your tools here (don't remove final answer)
|
| 80 |
max_steps=6,
|
| 81 |
verbosity_level=1,
|
| 82 |
grammar=None,
|