tavily-python
library and an API key from Tavily.
Parameter | Type | Default | Description |
---|---|---|---|
api_key | Optional[str] | None | Tavily API key. If not provided, will use TAVILY_API_KEY environment variable. |
enable_search | bool | True | Enable search functionality. |
enable_search_context | bool | False | Enable search context functionality using Tavily’s context API. |
all | bool | False | Enable all available functions in the toolkit. |
max_tokens | int | 6000 | Maximum number of tokens to use in search results. |
include_answer | bool | True | Whether to include an AI-generated answer summary in the response. |
search_depth | Literal['basic', 'advanced'] | 'advanced' | Depth of search - ‘basic’ for faster results or ‘advanced’ for more comprehensive search. |
format | Literal['json', 'markdown'] | 'markdown' | Output format - ‘json’ for raw data or ‘markdown’ for formatted text. |
Function | Description |
---|---|
web_search_using_tavily | Search the web for a given query using Tavily API. Parameters include query (str) for the search query and max_results (int, default=5) for maximum number of results. Returns JSON string of results with titles, URLs, content and relevance scores in specified format. |
web_search_with_tavily | Alternative search function that uses Tavily’s search context API. Parameters include query (str) for the search query. Returns contextualized search results. Only available when enable_search_context is True. |