A tool store for AI agents and LLMs
Tool: an API used to access data or take actions
# lets say you provide stock market data. here's what 'building a tool'
# looks like:
import requests
def get_most_recent_stock_price(ticker: str) -> float:
"""
Accepts any active US stock ticker.
Returns the most recent trade price for the provided ticker.
"""
price = requests.get(f"<your_api>/price/{ticker}").json()
return price
from tools.openai import Tools
from openai import OpenAI
client = OpenAI()
toolbelt = Tools()
messages = [{"role": "user", "content": "What is the weather in Miami?"}]
chat_completion = client.chat.completions.create(
messages=messages,
model="gpt-3.5-turbo",
# find the most relevant tools from the marketplace
# based on the current chat history
tools=toolbelt.find(messages, top=10, rank="best-rated")
)