The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Update TavilySearch to use TavilyClient instead of the deprecated Client (#24270)
Rahul Raghavendra Choudhuryf5a38772a8a1
diff --git a/libs/community/langchain_community/retrievers/tavily_search_api.py b/libs/community/langchain_community/retrievers/tavily_search_api.pyindex 317b5774ed..a23d654a73 100644--- a/libs/community/langchain_community/retrievers/tavily_search_api.py+++ b/libs/community/langchain_community/retrievers/tavily_search_api.py@@ -31,14 +31,18 @@ class TavilySearchAPIRetriever(BaseRetriever):self, query: str, *, run_manager: CallbackManagerForRetrieverRun) -> List[Document]:try:- from tavily import Client+ try:+ from tavily import TavilyClient+ except ImportError:+ # Older of tavily used Client+ from tavily import Client as TavilyClientexcept ImportError:raise ImportError("Tavily python package not found. ""Please install it with `pip install tavily-python`.")- tavily = Client(api_key=self.api_key or os.environ["TAVILY_API_KEY"])+ tavily = TavilyClient(api_key=self.api_key or os.environ["TAVILY_API_KEY"])max_results = self.k if not self.include_generated_answer else self.k - 1response = tavily.search(query=query,