[PROMPT][Tool Prompt]

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

@ -23,7 +23,7 @@ load_dotenv()
# Define a tool
@tool
def search_api(query: str):
def search_api(query: str, description: str):
"""Search the web for the query
Args:
@ -35,6 +35,25 @@ def search_api(query: str):
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
api_key = os.environ.get("OPENAI_API_KEY")

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

Loading…
Cancel
Save