Tools
Tavily
TavilyTools enable an Agent to search the web using the Tavily API.
Prerequisites
The following examples requires the tavily-python
library and an API key from Tavily.
Example
The following agent will run a search on Tavily for “language models” and print the response.
cookbook/tools/tavily_tools.py
Toolkit Params
Parameter | Type | Default | Description |
---|---|---|---|
api_key | str | - | The API key used for authentication to access the service. |
search | bool | True | Determines whether search functionality is enabled. |
max_tokens | int | 6000 | The maximum number of tokens to use in operations. |
include_answer | bool | True | Specifies if the answer should be included in the response. |
search_depth | Literal['basic', 'advanced'] | 'advanced' | Defines the depth of search, either ‘basic’ or ‘advanced’. |
format | Literal['json', 'markdown'] | 'markdown' | The format of the output, either ‘json’ or ‘markdown’. |
use_search_context | bool | False | Indicates if the search should consider the context provided in the request. |
Toolkit Functions
Function | Description |
---|---|
web_search_using_tavily | This function uses the Tavily API to provide realtime online information about the query. |