Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,23 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
import random
|
| 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 get_random_number_between_range(start_range:int, end_range:int)-> int: #it's import to specify the return type
|
|
|
|
| 7 |
import random
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
from pydantic import BaseModel, Field
|
| 11 |
+
import random
|
| 12 |
+
|
| 13 |
+
class RandomNumberInput(BaseModel):
|
| 14 |
+
start_range: int = Field(..., description="The start number of the range")
|
| 15 |
+
end_range: int = Field(..., description="The end number of the range")
|
| 16 |
+
|
| 17 |
+
@tool(args_schema=RandomNumberInput)
|
| 18 |
+
def get_random_number_between_range(start_range: int, end_range: int) -> int:
|
| 19 |
+
"""A tool that generates a random number given a range.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
start_range: The start number of the range.
|
| 23 |
+
end_range: The end number of the range.
|
| 24 |
+
"""
|
| 25 |
+
return random.randint(start_range, end_range)
|
| 26 |
+
|
| 27 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 28 |
@tool
|
| 29 |
def get_random_number_between_range(start_range:int, end_range:int)-> int: #it's import to specify the return type
|