Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,20 +19,10 @@ from Gradio_UI import GradioUI
|
|
| 19 |
# """
|
| 20 |
# return "What magic will you build ?"
|
| 21 |
|
| 22 |
-
@tool
|
| 23 |
-
def my_custom_tool(arg1: str, arg2: int) -> str:
|
| 24 |
-
"""
|
| 25 |
-
A tool that repeats the input string in uppercase a given number of times.
|
| 26 |
-
|
| 27 |
-
Args:
|
| 28 |
-
arg1: the string to repeat
|
| 29 |
-
arg2: the number of repetitions
|
| 30 |
-
"""
|
| 31 |
-
repeated = (arg1.upper() + " ") * arg2
|
| 32 |
-
return repeated.strip()
|
| 33 |
|
|
|
|
| 34 |
@tool
|
| 35 |
-
def
|
| 36 |
"""
|
| 37 |
A tool that creates a personalized greeting repeated multiple times.
|
| 38 |
|
|
@@ -44,7 +34,7 @@ def my_custom_tool2(arg1: str, arg2: int) -> str:
|
|
| 44 |
return " ".join([greeting] * arg2)
|
| 45 |
|
| 46 |
|
| 47 |
-
|
| 48 |
@tool
|
| 49 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 50 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -90,7 +80,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 90 |
agent = CodeAgent(
|
| 91 |
model=model,
|
| 92 |
#tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 93 |
-
tools=[get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
|
| 94 |
max_steps=6,
|
| 95 |
verbosity_level=1,
|
| 96 |
grammar=None,
|
|
|
|
| 19 |
# """
|
| 20 |
# return "What magic will you build ?"
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
# Tool to create a personalized greeting repeated a specific number of times.
|
| 24 |
@tool
|
| 25 |
+
def my_custom_tool(arg1: str, arg2: int) -> str:
|
| 26 |
"""
|
| 27 |
A tool that creates a personalized greeting repeated multiple times.
|
| 28 |
|
|
|
|
| 34 |
return " ".join([greeting] * arg2)
|
| 35 |
|
| 36 |
|
| 37 |
+
# Tool to get the current local time in your chosen timezone.
|
| 38 |
@tool
|
| 39 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 40 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 80 |
agent = CodeAgent(
|
| 81 |
model=model,
|
| 82 |
#tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 83 |
+
tools=[my_custom_tool, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
|
| 84 |
max_steps=6,
|
| 85 |
verbosity_level=1,
|
| 86 |
grammar=None,
|