Add a non-specific start function
Browse files
app.py
CHANGED
@@ -17,13 +17,26 @@ if verbose: print("Running app.py")
|
|
17 |
## https://huggingface.co/spaces/DenverJones/First_agent_template/blob/main/app.py ## randomly select a Motivational Quote
|
18 |
|
19 |
@tool
|
20 |
-
def
|
21 |
-
"""A tool that takes no arguments but returns a list of tools available to the agent.
|
22 |
I prefer to use this tool when someone initiates a non-specific conversations for example if they say "Hi" or "Hello".
|
23 |
At least then they will know the kinds of tools available to the them via this agent.
|
24 |
Args:
|
25 |
None
|
26 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
try:
|
28 |
result = [f.name for f in tool_list]
|
29 |
return result
|
@@ -68,7 +81,7 @@ web_search = DuckDuckGoSearchTool()
|
|
68 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True) ## https://huggingface.co/spaces/agents-course/text-to-image
|
69 |
|
70 |
# Create a list of the tools available to the agent - (don't remove final answer)
|
71 |
-
tool_list = [final_answer, get_current_time_in_timezone, image_generation_tool, toss_a_die, available_tools, web_search]
|
72 |
|
73 |
MODEL_IDS = [
|
74 |
#'https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud/',
|
|
|
17 |
## https://huggingface.co/spaces/DenverJones/First_agent_template/blob/main/app.py ## randomly select a Motivational Quote
|
18 |
|
19 |
@tool
|
20 |
+
def non_specific_start()-> str:
|
21 |
+
"""A tool that takes no arguments but returns a welcome message along with a list of tools available to the agent.
|
22 |
I prefer to use this tool when someone initiates a non-specific conversations for example if they say "Hi" or "Hello".
|
23 |
At least then they will know the kinds of tools available to the them via this agent.
|
24 |
Args:
|
25 |
None
|
26 |
"""
|
27 |
+
try:
|
28 |
+
result = "Welcome to this basic agent interface. Here are some of the tools I have access to" + str.join(available_tools())
|
29 |
+
return result
|
30 |
+
except Exception as e:
|
31 |
+
return "Welcome to this basic agent interface."
|
32 |
+
|
33 |
+
|
34 |
+
@tool
|
35 |
+
def available_tools()-> str:
|
36 |
+
"""A tool that takes no arguments but returns a list of tools available to the agent.
|
37 |
+
Args:
|
38 |
+
None
|
39 |
+
"""
|
40 |
try:
|
41 |
result = [f.name for f in tool_list]
|
42 |
return result
|
|
|
81 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True) ## https://huggingface.co/spaces/agents-course/text-to-image
|
82 |
|
83 |
# Create a list of the tools available to the agent - (don't remove final answer)
|
84 |
+
tool_list = [final_answer, non_specific_start, get_current_time_in_timezone, image_generation_tool, toss_a_die, available_tools, web_search]
|
85 |
|
86 |
MODEL_IDS = [
|
87 |
#'https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud/',
|