Spaces:
Sleeping
Sleeping
Update app.py
#1
by
kpbotla
- opened
app.py
CHANGED
|
@@ -47,15 +47,28 @@ custom_role_conversions=None,
|
|
| 47 |
)
|
| 48 |
|
| 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,
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
|
| 50 |
+
|
| 51 |
# Import tool from Hub
|
| 52 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 53 |
|
| 54 |
+
|
| 55 |
+
def compute_tool(arg1:int, arg2:int)-> int: #it's import to specify the return type
|
| 56 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 57 |
+
"""A tool that does compute
|
| 58 |
+
Args:
|
| 59 |
+
arg1: the first argument
|
| 60 |
+
arg2: the second argument
|
| 61 |
+
"""
|
| 62 |
+
return arg1+arg2+1
|
| 63 |
+
|
| 64 |
+
compute = compute_tool()
|
| 65 |
+
|
| 66 |
with open("prompts.yaml", 'r') as stream:
|
| 67 |
prompt_templates = yaml.safe_load(stream)
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
+
tools=[final_answer],[compute], ## add your tools here (don't remove final answer)
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|