Deprecation NoticeThis tool has been deprecated. Please use the TavilySearch tool in the
@langchain/tavily
package, instead.Overview
Integration details
Class | Package | PY support | Version |
---|---|---|---|
TavilySearchResults | @langchain/community | ✅ |
Setup
The integration lives in the@langchain/community
package, which you can install as shown below:
Credentials
Set up an API key here and set it as an environment variable namedTAVILY_API_KEY
.
Instantiation
You can import and instantiate an instance of theTavilySearchResults
tool like this:
Invocation
Invoke directly with args
You can invoke the tool directly like this:Invoke with ToolCall
We can also invoke the tool with a model-generatedToolCall
, in which case a ToolMessage
will be returned:
Chaining
We can use our tool in a chain by first binding it to a tool-calling model and then calling it:Agents
For guides on how to use LangChain tools in agents, see the LangGraph.js docs.API reference
For detailed documentation of allTavilySearchResults
features and configurations head to the API reference:
api.js.langchain.com/classes/langchain_community_tools_tavily_search.TavilySearchResults.html