Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ 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
|
|
@@ -17,7 +17,29 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 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:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 7 |
from Gradio_UI import GradioUI
|
| 8 |
+
import random
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
|
|
|
| 17 |
arg2: the second argument
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
+
|
| 21 |
+
@tool
|
| 22 |
+
def tell_joke() -> str:
|
| 23 |
+
"""Returns a random joke."""
|
| 24 |
+
print("DEBUG: tell_joke() was called")
|
| 25 |
+
jokes = [
|
| 26 |
+
"Why don't skeletons fight each other? They don't have the guts.",
|
| 27 |
+
"I told my wife she was drawing her eyebrows too high. She looked surprised.",
|
| 28 |
+
"Why don’t scientists trust atoms? Because they make up everything!"
|
| 29 |
+
]
|
| 30 |
+
return random.choice(jokes)
|
| 31 |
|
| 32 |
+
@tool
|
| 33 |
+
def random_fact() -> str:
|
| 34 |
+
"""Fetches a random fun fact."""
|
| 35 |
+
print("DEBUG: random_fact() was called")
|
| 36 |
+
facts = [
|
| 37 |
+
"Honey never spoils.",
|
| 38 |
+
"Octopuses have three hearts.",
|
| 39 |
+
"Bananas are berries, but strawberries are not."
|
| 40 |
+
]
|
| 41 |
+
return random.choice(facts)
|
| 42 |
+
|
| 43 |
@tool
|
| 44 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 45 |
"""A tool that fetches the current local time in a specified timezone.
|