Spaces:
Sleeping
Sleeping
added custom tool is_fav_series
Browse files
app.py
CHANGED
|
@@ -10,14 +10,18 @@ from Gradio_UI import GradioUI
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
-
def
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
-
"""A tool that
|
| 16 |
Args:
|
| 17 |
-
|
| 18 |
-
arg2: the second argument
|
| 19 |
"""
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
@tool
|
| 23 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -58,7 +62,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 58 |
|
| 59 |
agent = CodeAgent(
|
| 60 |
model=model,
|
| 61 |
-
tools=[final_answer, web_search, visit_webpage], ## add your tools here (don't remove final answer)
|
| 62 |
max_steps=6,
|
| 63 |
verbosity_level=1,
|
| 64 |
grammar=None,
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def is_fav_series(series: str)-> str: #it's import to specify the return type
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
+
"""A tool that gives whether the supplied series name is one of the favourite series of the agent creator/owner
|
| 16 |
Args:
|
| 17 |
+
series: A string representing the name of the series
|
|
|
|
| 18 |
"""
|
| 19 |
+
fav_series_list = ['The Castle', 'Mentalist', 'The Americans', 'Big Bang Theory']
|
| 20 |
+
|
| 21 |
+
if series in fav_series_list:
|
| 22 |
+
return f"Yes, {series} is the favourite series of the agent creator"
|
| 23 |
+
else:
|
| 24 |
+
return f"No, {series} is the favourite series of the agent creator"
|
| 25 |
|
| 26 |
@tool
|
| 27 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
+
tools=[final_answer, web_search, visit_webpage, is_fav_series], ## add your tools here (don't remove final answer)
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|