Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,31 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 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.
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
@tool
|
| 22 |
+
def my_test_tool(genre: str)-> str: #it's import to specify the return type
|
| 23 |
+
"""A tool that generates a quote given the genre
|
| 24 |
+
Args:
|
| 25 |
+
genre: the genre of the quote
|
| 26 |
+
"""
|
| 27 |
+
import random
|
| 28 |
+
quotes = {
|
| 29 |
+
'inspirational': [
|
| 30 |
+
'Be yourself; everyone else is already taken.',
|
| 31 |
+
'Be the change that you wish to see in the world.',
|
| 32 |
+
'Live as if you were to die tomorrow. Learn as if you were to live forever.'
|
| 33 |
+
],
|
| 34 |
+
'humorous': [
|
| 35 |
+
'A day without sunshine is like, you know, night.',
|
| 36 |
+
'I love deadlines. I love the whooshing noise they make as they go by.'
|
| 37 |
+
],
|
| 38 |
+
'philosophical': [
|
| 39 |
+
'Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.',
|
| 40 |
+
'A day without laughter is a day wasted.',
|
| 41 |
+
'Man is the only creature who refuses to be what he is.'
|
| 42 |
+
]
|
| 43 |
+
}
|
| 44 |
+
return random.choice(quotes.get(genre, ['Sorry I do not have any quotes that are {}'.format(genre)]))
|
| 45 |
+
|
| 46 |
@tool
|
| 47 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 48 |
"""A tool that fetches the current local time in a specified timezone.
|