Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,32 @@ 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:
|
|
|
|
| 17 |
arg2: the second argument
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
+
|
| 21 |
+
@tool
|
| 22 |
+
def draw_rectangle(width: int, length: int) -> str: #it's import to specify the return type
|
| 23 |
+
"""A tool that draws a hollow rectangle using ASCII characters
|
| 24 |
+
Args:
|
| 25 |
+
width: the horizontal width of the rectangle
|
| 26 |
+
length: the vertical length (height) of the rectangle
|
| 27 |
+
"""
|
| 28 |
+
if width < 2 or length < 2:
|
| 29 |
+
return "Error: Width and length must be at least 2."
|
| 30 |
+
|
| 31 |
+
# Create the top and bottom borders (e.g., +---+)
|
| 32 |
+
horizontal_line = "+" + "-" * (width - 2) + "+"
|
| 33 |
+
|
| 34 |
+
# Create the middle sections (e.g., | |)
|
| 35 |
+
middle_line = "|" + " " * (width - 2) + "|"
|
| 36 |
+
|
| 37 |
+
# Build the rectangle
|
| 38 |
+
rectangle = [horizontal_line]
|
| 39 |
+
|
| 40 |
+
for _ in range(length - 2):
|
| 41 |
+
rectangle.append(middle_line)
|
| 42 |
+
|
| 43 |
+
rectangle.append(horizontal_line)
|
| 44 |
+
|
| 45 |
+
return "\n".join(rectangle)
|
| 46 |
|
| 47 |
@tool
|
| 48 |
def get_current_time_in_timezone(timezone: str) -> str:
|