Tools

Tools are utilities designed to be called by a model: their inputs are designed to be generated by models, and their outputs are designed to be passed back to models.

toolkit is a collection of tools meant to be used together.

This notebook goes over how to use the Brave Search tool. Go to the Brave Website to sign up for a free account and get an API key.

%pip install --upgrade --quiet langchain-community
from langchain_community.tools import BraveSearch

API Reference:BraveSearch

api_key = "API KEY"
tool = BraveSearch.from_api_key(api_key=api_key, search_kwargs={"count": 3})

# or if you want to get the api key from environment variable BRAVE_SEARCH_API_KEY, and leave search_kwargs empty
# tool = BraveSearch()

# or if you want to provide just the api key, and leave search_kwargs empty
# tool = BraveSearch.from_api_key(api_key=api_key)

# or if you want to provide just the search_kwargs and read the api key from the BRAVE_SEARCH_API_KEY environment variable
# tool = BraveSearch.from_search_kwargs(search_kwargs={"count": 3})
tool.run("obama middle name")