Added tools
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
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
"""A tool that does nothing yet
|
15 |
Args:
|
@@ -42,6 +42,23 @@ model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',#
|
|
42 |
custom_role_conversions=None,
|
43 |
)
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
# Import tool from Hub
|
47 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
@@ -51,7 +68,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
51 |
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
55 |
max_steps=6,
|
56 |
verbosity_level=1,
|
57 |
grammar=None,
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def my_custom_tool(arg1:str, arg2:int)-> 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 does nothing yet
|
15 |
Args:
|
|
|
42 |
custom_role_conversions=None,
|
43 |
)
|
44 |
|
45 |
+
custom_tool = my_custom_tool()
|
46 |
+
model = HfApiModel(
|
47 |
+
max_tokens=2096,
|
48 |
+
temperature=0.5,
|
49 |
+
model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
|
50 |
+
custom_role_conversions=None,
|
51 |
+
)
|
52 |
+
|
53 |
+
get_time = get_current_time_in_timezone()
|
54 |
+
model = HfApiModel(
|
55 |
+
max_tokens=2096,
|
56 |
+
temperature=0.5,
|
57 |
+
model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
|
58 |
+
custom_role_conversions=None,
|
59 |
+
)
|
60 |
+
|
61 |
+
|
62 |
|
63 |
# Import tool from Hub
|
64 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
68 |
|
69 |
agent = CodeAgent(
|
70 |
model=model,
|
71 |
+
tools=[custom_tool, get_time, final_answer], ## add your tools here (don't remove final answer)
|
72 |
max_steps=6,
|
73 |
verbosity_level=1,
|
74 |
grammar=None,
|