Add random dice roll
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
@@ -25,10 +26,13 @@ def toss_a_die(k: int) -> int:
|
|
| 25 |
Args:
|
| 26 |
k: An integer specifying the number of sides on the die. If not specified, a good default would be to assume k=6 sides.
|
| 27 |
"""
|
| 28 |
-
if k==None:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
@tool
|
| 34 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
import random
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
|
|
|
| 26 |
Args:
|
| 27 |
k: An integer specifying the number of sides on the die. If not specified, a good default would be to assume k=6 sides.
|
| 28 |
"""
|
| 29 |
+
if k==None: k=6
|
| 30 |
+
|
| 31 |
+
try:
|
| 32 |
+
value = random.randint(1, k)
|
| 33 |
+
return f"The random roll of a dice gives a value of {value}"
|
| 34 |
+
except Exception as e:
|
| 35 |
+
return f"How many sides does the dice have?"
|
| 36 |
|
| 37 |
@tool
|
| 38 |
def get_current_time_in_timezone(timezone: str) -> str:
|