Overview
Integration details
Class | Package | PY support | Version |
---|---|---|---|
TavilySearch | @langchain/tavily | ✅ |
Setup
The integration lives in the@langchain/tavily
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 theTavilySearch
tool like this:
Invocation
Invoke directly with args
The Tavily search tool accepts the following arguments during invocation:-
query
(required): A natural language search query -
The following arguments can also be set during invocation :
includeImages
,searchDepth
,timeRange
,includeDomains
,excludeDomains
,includeImages
. -
For reliability and performance reasons, certain parameters that affect response size cannot be modified during invocation:
includeAnswer
andincludeRawContent
. These limitations prevent unexpected context window issues and ensure consistent results.
Invoke with ToolCall
We can also invoke the tool with a model-generatedToolCall
, in which case a ToolMessage
will be returned: