Add tool list
Browse files
app.py
CHANGED
|
@@ -26,6 +26,16 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 26 |
## https://huggingface.co/spaces/iamnamas/nse_stockprice_agent ## Look up the price of an NSE stock like TATAMOTORS or ADANINT
|
| 27 |
## https://huggingface.co/spaces/DenverJones/First_agent_template/blob/main/app.py ## randomly select a Motivational Quote
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
@tool
|
| 30 |
def toss_a_die(k: int) -> int:
|
| 31 |
"""A tool to toss a k-sided die / dice and return the value showing on that die / dice.
|
|
@@ -113,10 +123,12 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
|
|
| 113 |
|
| 114 |
with open("prompts.yaml", 'r') as stream:
|
| 115 |
prompt_templates = yaml.safe_load(stream)
|
| 116 |
-
|
|
|
|
|
|
|
| 117 |
agent = CodeAgent(
|
| 118 |
model=model,
|
| 119 |
-
tools=
|
| 120 |
max_steps=6,
|
| 121 |
verbosity_level=1,
|
| 122 |
grammar=None,
|
|
|
|
| 26 |
## https://huggingface.co/spaces/iamnamas/nse_stockprice_agent ## Look up the price of an NSE stock like TATAMOTORS or ADANINT
|
| 27 |
## https://huggingface.co/spaces/DenverJones/First_agent_template/blob/main/app.py ## randomly select a Motivational Quote
|
| 28 |
|
| 29 |
+
@tool
|
| 30 |
+
def available_tools(None)-> str: #it's import to specify the return type
|
| 31 |
+
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 32 |
+
"""A tool that takes no arguments but returns a list of tools available to the agent
|
| 33 |
+
Args:
|
| 34 |
+
None
|
| 35 |
+
"""
|
| 36 |
+
return tool_list
|
| 37 |
+
|
| 38 |
+
|
| 39 |
@tool
|
| 40 |
def toss_a_die(k: int) -> int:
|
| 41 |
"""A tool to toss a k-sided die / dice and return the value showing on that die / dice.
|
|
|
|
| 123 |
|
| 124 |
with open("prompts.yaml", 'r') as stream:
|
| 125 |
prompt_templates = yaml.safe_load(stream)
|
| 126 |
+
|
| 127 |
+
tool_list = [final_answer, get_current_time_in_timezone, image_generation_tool, toss_a_die, available_tools]
|
| 128 |
+
|
| 129 |
agent = CodeAgent(
|
| 130 |
model=model,
|
| 131 |
+
tools=tool_list, ## add your tools here (don't remove final answer)
|
| 132 |
max_steps=6,
|
| 133 |
verbosity_level=1,
|
| 134 |
grammar=None,
|