[PROMPT][Tool Prompt]

pull/263/head
Kye 1 year ago
parent 1aefe16065
commit 1627d30855

@ -23,7 +23,7 @@ load_dotenv()
# Define a tool # Define a tool
@tool @tool
def search_api(query: str): def search_api(query: str, description: str):
"""Search the web for the query """Search the web for the query
Args: Args:
@ -35,6 +35,25 @@ def search_api(query: str):
return f"Search results for {query}" return f"Search results for {query}"
@tool
def weather_api(query: str,):
"""_summary_
Args:
query (str): _description_
"""
print(f"Getting the weather for {query}")
@tool
def rapid_api(query: str):
"""_summary_
Args:
query (str): _description_
"""
print(f"Getting the weather for {query}")
# Get the API key from the environment # Get the API key from the environment
api_key = os.environ.get("OPENAI_API_KEY") api_key = os.environ.get("OPENAI_API_KEY")

@ -12,36 +12,40 @@ This will enable you to leave the autonomous loop.
DYNAMICAL_TOOL_USAGE = """ DYNAMICAL_TOOL_USAGE = """
You have access to the following tools: You have access to the following tools:
Output a JSON object with the following structure to use the tools Output a JSON object with the following structure to use the tools
commands: { commands: {
"tools": { "tools": {
tool1: "tool_name", tool1: "search_api",
"params": { "params": {
"tool1": "inputs", "query": "What is the weather in New York?",
"tool1": "inputs" "description": "Get the weather in New York"
} }
"tool2: "tool_name", "tool2: "weather_api",
"params": { "params": {
"tool1": "inputs", "query": "What is the weather in Silicon Valley",
"tool1": "inputs"
} }
"tool3: "tool_name", "tool3: "rapid_api",
"params": { "params": {
"tool1": "inputs", "query": "Use the rapid api to get the weather in Silicon Valley",
"tool1": "inputs"
} }
} }
} }
-------------TOOLS---------------------------
{tools}
""" """
########### FEW SHOT EXAMPLES ################
SCENARIOS = """ SCENARIOS = """
commands: { commands: {
"tools": { "tools": {
tool1: "tool_name", tool1: "function",
"params": { "params": {
"tool1": "inputs", "input": "inputs",
"tool1": "inputs" "tool1": "inputs"
} }
"tool2: "tool_name", "tool2: "tool_name",

Loading…
Cancel
Save