Spaces:
Runtime error
Runtime error
adding search_tool
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ 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 coffee_drinking_permission(hour:int, day:
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that decides whether it is allowed to drink coffee for user at this time or not.
|
| 15 |
Args:
|
|
@@ -58,10 +58,12 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
|
|
| 58 |
|
| 59 |
with open("prompts.yaml", 'r') as stream:
|
| 60 |
prompt_templates = yaml.safe_load(stream)
|
|
|
|
|
|
|
| 61 |
|
| 62 |
agent = CodeAgent(
|
| 63 |
model=model,
|
| 64 |
-
tools=[final_answer, get_current_time_in_timezone, coffee_drinking_permission], ## add your tools here (don't remove final answer) image_generation_tool, multiply_two_int_numbers,
|
| 65 |
max_steps=6,
|
| 66 |
verbosity_level=1,
|
| 67 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def coffee_drinking_permission(hour:int, day:str)-> bool: #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 decides whether it is allowed to drink coffee for user at this time or not.
|
| 15 |
Args:
|
|
|
|
| 58 |
|
| 59 |
with open("prompts.yaml", 'r') as stream:
|
| 60 |
prompt_templates = yaml.safe_load(stream)
|
| 61 |
+
|
| 62 |
+
search_tool = DuckDuckGoSearchTool()
|
| 63 |
|
| 64 |
agent = CodeAgent(
|
| 65 |
model=model,
|
| 66 |
+
tools=[final_answer, get_current_time_in_timezone, coffee_drinking_permission, search_tool], ## add your tools here (don't remove final answer) image_generation_tool, multiply_two_int_numbers,
|
| 67 |
max_steps=6,
|
| 68 |
verbosity_level=1,
|
| 69 |
grammar=None,
|