Adapter
TAVILY_API_URL = 'https://api.tavily.com'
module-attribute
logger = logging.getLogger(__name__)
module-attribute
FakeTavilyClient
Bases: MyTavilyClient
tavily_client = None
class-attribute
instance-attribute
raw_results_async(query, max_results=5, search_depth='advanced', include_domains=None, exclude_domains=None, include_answer=False, include_raw_content=False, include_images=False)
async
MyTavilyClient
Bases: BaseModel
Wrapper for Tavily Search API.
2024-10-09 -- Modified from the langchain_community implementation, but uses the tavily implementation.
model_config = ConfigDict(extra='forbid', arbitrary_types_allowed=True)
class-attribute
instance-attribute
tavily_client
instance-attribute
clean_results(results, as_dicts=False)
staticmethod
Clean results from Tavily Search API.
raw_results_async(query, max_results=5, search_depth='advanced', include_domains=None, exclude_domains=None, include_answer=False, include_raw_content=False, include_images=False)
async
Get results from the Tavily Search API asynchronously.
results_async(query, max_results=5, search_depth='advanced', include_domains=None, exclude_domains=None, include_answer=False, include_raw_content=False, include_images=False)
async
Run query through Tavily Search and return metadata.
| PARAMETER | DESCRIPTION |
|---|---|
query
|
The query to search for.
TYPE:
|
max_results
|
The maximum number of results to return.
TYPE:
|
search_depth
|
The depth of the search. Can be "basic" or "advanced".
TYPE:
|
include_domains
|
A list of domains to include in the search.
TYPE:
|
exclude_domains
|
A list of domains to exclude from the search.
TYPE:
|
include_answer
|
Whether to include the answer in the results.
TYPE:
|
include_raw_content
|
Whether to include the raw content in the results.
TYPE:
|
include_images
|
Whether to include images in the results.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
query
|
The query that was searched for.
TYPE:
|
follow_up_questions
|
A list of follow-up questions.
TYPE:
|
response_time
|
The response time of the query.
TYPE:
|
answer
|
The answer to the query.
TYPE:
|
images
|
A list of images.
TYPE:
|
results
|
A list of dictionaries containing the results: title: The title of the result. url: The url of the result. content: The content of the result. score: The score of the result. raw_content: The raw content of the result.
TYPE:
|
TavilyCleanedResult
Bases: BaseModel
content
instance-attribute
url
instance-attribute
TavilyResult
Bases: BaseModel
content
instance-attribute
published_date = None
class-attribute
instance-attribute
raw_content = None
class-attribute
instance-attribute
score
instance-attribute
title
instance-attribute
url
instance-attribute
TavilySearchResult
Bases: BaseModel