Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
-
def draw_rectangle(width: int, length: int) -> str:
|
| 23 |
"""A tool that draws a hollow rectangle using ASCII characters
|
| 24 |
Args:
|
| 25 |
width: the horizontal width of the rectangle
|
|
@@ -34,15 +34,18 @@ def draw_rectangle(width: int, length: int) -> str: #it's import to specify the
|
|
| 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 |
-
|
|
|
|
|
|
|
| 46 |
|
| 47 |
@tool
|
| 48 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
| 22 |
+
def draw_rectangle(width: int, length: int) -> str:
|
| 23 |
"""A tool that draws a hollow rectangle using ASCII characters
|
| 24 |
Args:
|
| 25 |
width: the horizontal width of the rectangle
|
|
|
|
| 34 |
# Create the middle sections (e.g., | |)
|
| 35 |
middle_line = "|" + " " * (width - 2) + "|"
|
| 36 |
|
| 37 |
+
# Build the rectangle list
|
| 38 |
rectangle = [horizontal_line]
|
| 39 |
|
| 40 |
for _ in range(length - 2):
|
| 41 |
rectangle.append(middle_line)
|
| 42 |
|
| 43 |
+
# Add the bottom line (Outside the loop)
|
| 44 |
rectangle.append(horizontal_line)
|
| 45 |
|
| 46 |
+
# JOIN WITH NEWLINES AND WRAP IN MARKDOWN CODE BLOCK
|
| 47 |
+
# This is the magic part that fixes the display:
|
| 48 |
+
return "```\n" + "\n".join(rectangle) + "\n```"
|
| 49 |
|
| 50 |
@tool
|
| 51 |
def get_current_time_in_timezone(timezone: str) -> str:
|