Spaces:
Sleeping
Sleeping
update custom tool
Browse files
app.py
CHANGED
|
@@ -9,14 +9,27 @@ 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
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""A tool that
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
arg2: the second argument
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -57,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[get_current_time_in_timezone, image_generation_tool, search_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def important_beings(being:str)-> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
+
"""A tool that informs the name of a important being to Marina
|
| 15 |
Args:
|
| 16 |
+
being: the only argument
|
|
|
|
| 17 |
"""
|
| 18 |
+
name = ""
|
| 19 |
+
|
| 20 |
+
match being:
|
| 21 |
+
case "pet":
|
| 22 |
+
name = "Scott"
|
| 23 |
+
case "boyfriend":
|
| 24 |
+
name = "Gabriel"
|
| 25 |
+
case "mom":
|
| 26 |
+
name = "Estefania"
|
| 27 |
+
case "dad":
|
| 28 |
+
name = "Fernando"
|
| 29 |
+
case "sister":
|
| 30 |
+
name = "Isabela"
|
| 31 |
+
|
| 32 |
+
return name
|
| 33 |
|
| 34 |
@tool
|
| 35 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 70 |
|
| 71 |
agent = CodeAgent(
|
| 72 |
model=model,
|
| 73 |
+
tools=[get_current_time_in_timezone, image_generation_tool, search_tool, important_beings, final_answer], ## add your tools here (don't remove final answer)
|
| 74 |
max_steps=6,
|
| 75 |
verbosity_level=1,
|
| 76 |
grammar=None,
|