Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,16 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
@@ -49,13 +59,14 @@ custom_role_conversions=None,
|
|
| 49 |
|
| 50 |
# Import tool from Hub
|
| 51 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
|
| 52 |
|
| 53 |
with open("prompts.yaml", 'r') as stream:
|
| 54 |
prompt_templates = yaml.safe_load(stream)
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
+
def magic_echo(arg1: str, arg2: int) -> str:
|
| 22 |
+
"""A tool that creates a magical echo effect.
|
| 23 |
+
|
| 24 |
+
Args:
|
| 25 |
+
arg1: The input string to be echoed.
|
| 26 |
+
arg2: The number of times to echo the input.
|
| 27 |
+
"""
|
| 28 |
+
echoed = " ".join([arg1] * arg2)
|
| 29 |
+
return f"✨ Magical Echo: {echoed} ✨"
|
| 30 |
+
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 33 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 59 |
|
| 60 |
# Import tool from Hub
|
| 61 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 62 |
+
web_search_tool= DuckDuckGoSearchTool()
|
| 63 |
|
| 64 |
with open("prompts.yaml", 'r') as stream:
|
| 65 |
prompt_templates = yaml.safe_load(stream)
|
| 66 |
|
| 67 |
agent = CodeAgent(
|
| 68 |
model=model,
|
| 69 |
+
tools=[web_search_tool,magic_echo,get_current_time_in_timezone,image_generation_tool,final_answer], ## add your tools here (don't remove final answer)
|
| 70 |
max_steps=6,
|
| 71 |
verbosity_level=1,
|
| 72 |
grammar=None,
|