The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
langchain[patch]: Migrate retrievers to use optional langchain community imports (#21155)
Eugene Yurtsevbec3eee3fad0
diff --git a/libs/community/langchain_community/retrievers/__init__.py b/libs/community/langchain_community/retrievers/__init__.pyindex a4b43dd978..82e90c0741 100644--- a/libs/community/langchain_community/retrievers/__init__.py+++ b/libs/community/langchain_community/retrievers/__init__.py@@ -28,7 +28,8 @@ if TYPE_CHECKING:from langchain_community.retrievers.arxiv import (ArxivRetriever,)- from langchain_community.retrievers.azure_cognitive_search import (+ from langchain_community.retrievers.azure_ai_search import (+ AzureAISearchRetriever,AzureCognitiveSearchRetriever,)from langchain_community.retrievers.bedrock import (@@ -100,6 +101,9 @@ if TYPE_CHECKING:from langchain_community.retrievers.qdrant_sparse_vector_retriever import (QdrantSparseVectorRetriever,)+ from langchain_community.retrievers.rememberizer import (+ RememberizerRetriever,+ )from langchain_community.retrievers.remote_retriever import (RemoteLangChainRetriever,)@@ -112,6 +116,7 @@ if TYPE_CHECKING:from langchain_community.retrievers.tfidf import (TFIDFRetriever,)+ from langchain_community.retrievers.thirdai_neuraldb import NeuralDBRetrieverfrom langchain_community.retrievers.vespa_retriever import (VespaRetriever,)@@ -131,46 +136,6 @@ if TYPE_CHECKING:ZillizRetriever,)-__all__ = [- "AmazonKendraRetriever",- "AmazonKnowledgeBasesRetriever",- "ArceeRetriever",- "ArxivRetriever",- "AzureCognitiveSearchRetriever",- "BM25Retriever",- "BreebsRetriever",- "ChaindeskRetriever",- "ChatGPTPluginRetriever",- "CohereRagRetriever",- "DocArrayRetriever",- "DriaRetriever",- "ElasticSearchBM25Retriever",- "EmbedchainRetriever",- "GoogleCloudEnterpriseSearchRetriever",- "GoogleDocumentAIWarehouseRetriever",- "GoogleVertexAIMultiTurnSearchRetriever",- "GoogleVertexAISearchRetriever",- "KNNRetriever",- "KayAiRetriever",- "LlamaIndexGraphRetriever",- "LlamaIndexRetriever",- "MetalRetriever",- "MilvusRetriever",- "OutlineRetriever",- "PineconeHybridSearchRetriever",- "PubMedRetriever",- "QdrantSparseVectorRetriever",- "RemoteLangChainRetriever",- "SVMRetriever",- "TFIDFRetriever",- "TavilySearchAPIRetriever",- "VespaRetriever",- "WeaviateHybridSearchRetriever",- "WikipediaRetriever",- "YouRetriever",- "ZepRetriever",- "ZillizRetriever",-]_module_lookup = {"AmazonKendraRetriever": "langchain_community.retrievers.kendra",@@ -224,4 +189,46 @@ def __getattr__(name: str) -> Any:raise AttributeError(f"module {__name__} has no attribute {name}")-__all__ = list(_module_lookup.keys())+__all__ = [+ "AmazonKendraRetriever",+ "AmazonKnowledgeBasesRetriever",+ "ArceeRetriever",+ "ArxivRetriever",+ "AzureCognitiveSearchRetriever",+ "AzureAISearchRetriever",+ "BM25Retriever",+ "BreebsRetriever",+ "ChaindeskRetriever",+ "ChatGPTPluginRetriever",+ "CohereRagRetriever",+ "DocArrayRetriever",+ "DriaRetriever",+ "ElasticSearchBM25Retriever",+ "EmbedchainRetriever",+ "GoogleCloudEnterpriseSearchRetriever",+ "GoogleDocumentAIWarehouseRetriever",+ "GoogleVertexAIMultiTurnSearchRetriever",+ "GoogleVertexAISearchRetriever",+ "KNNRetriever",+ "KayAiRetriever",+ "LlamaIndexGraphRetriever",+ "LlamaIndexRetriever",+ "MetalRetriever",+ "MilvusRetriever",+ "NeuralDBRetriever",+ "OutlineRetriever",+ "PineconeHybridSearchRetriever",+ "PubMedRetriever",+ "QdrantSparseVectorRetriever",+ "RememberizerRetriever",+ "RemoteLangChainRetriever",+ "SVMRetriever",+ "TFIDFRetriever",+ "TavilySearchAPIRetriever",+ "VespaRetriever",+ "WeaviateHybridSearchRetriever",+ "WikipediaRetriever",+ "YouRetriever",+ "ZepRetriever",+ "ZillizRetriever",+]diff --git a/libs/community/tests/unit_tests/retrievers/test_imports.py b/libs/community/tests/unit_tests/retrievers/test_imports.pyindex 773da501d1..6e438bf5cd 100644--- a/libs/community/tests/unit_tests/retrievers/test_imports.py+++ b/libs/community/tests/unit_tests/retrievers/test_imports.py@@ -32,6 +32,8 @@ EXPECTED_ALL = ["RememberizerRetriever","SVMRetriever","TavilySearchAPIRetriever",+ "NeuralDBRetriever",+ "RememberizerRetriever","TFIDFRetriever","BM25Retriever","VespaRetriever",diff --git a/libs/langchain/langchain/retrievers/__init__.py b/libs/langchain/langchain/retrievers/__init__.pyindex a1ba007f36..514b98c092 100644--- a/libs/langchain/langchain/retrievers/__init__.py+++ b/libs/langchain/langchain/retrievers/__init__.py@@ -17,7 +17,7 @@ the backbone of a retriever, but there are other types of retrievers as well.Document, Serializable, Callbacks,CallbackManagerForRetrieverRun, AsyncCallbackManagerForRetrieverRun"""-from typing import Any+from typing import TYPE_CHECKING, Anyfrom langchain._api.module_import import create_importerfrom langchain.retrievers.contextual_compression import ContextualCompressionRetriever@@ -34,14 +34,96 @@ from langchain.retrievers.time_weighted_retriever import ()from langchain.retrievers.web_research import WebResearchRetriever-import_lookup = create_importer(- __package__, fallback_module="langchain_community.retrievers"-)+if TYPE_CHECKING:+ from langchain_community.retrievers import (+ AmazonKendraRetriever,+ AmazonKnowledgeBasesRetriever,+ ArceeRetriever,+ ArxivRetriever,+ AzureAISearchRetriever,+ AzureCognitiveSearchRetriever,+ BM25Retriever,+ ChaindeskRetriever,+ ChatGPTPluginRetriever,+ CohereRagRetriever,+ DocArrayRetriever,+ DriaRetriever,+ ElasticSearchBM25Retriever,+ EmbedchainRetriever,+ GoogleCloudEnterpriseSearchRetriever,+ GoogleDocumentAIWarehouseRetriever,+ GoogleVertexAIMultiTurnSearchRetriever,+ GoogleVertexAISearchRetriever,+ KayAiRetriever,+ KNNRetriever,+ LlamaIndexGraphRetriever,+ LlamaIndexRetriever,+ MetalRetriever,+ MilvusRetriever,+ NeuralDBRetriever,+ OutlineRetriever,+ PineconeHybridSearchRetriever,+ PubMedRetriever,+ RemoteLangChainRetriever,+ SVMRetriever,+ TavilySearchAPIRetriever,+ TFIDFRetriever,+ VespaRetriever,+ WeaviateHybridSearchRetriever,+ WikipediaRetriever,+ ZepRetriever,+ ZillizRetriever,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "AmazonKendraRetriever": "langchain_community.retrievers",+ "AmazonKnowledgeBasesRetriever": "langchain_community.retrievers",+ "ArceeRetriever": "langchain_community.retrievers",+ "ArxivRetriever": "langchain_community.retrievers",+ "AzureAISearchRetriever": "langchain_community.retrievers",+ "AzureCognitiveSearchRetriever": "langchain_community.retrievers",+ "ChatGPTPluginRetriever": "langchain_community.retrievers",+ "ChaindeskRetriever": "langchain_community.retrievers",+ "CohereRagRetriever": "langchain_community.retrievers",+ "ElasticSearchBM25Retriever": "langchain_community.retrievers",+ "EmbedchainRetriever": "langchain_community.retrievers",+ "GoogleDocumentAIWarehouseRetriever": "langchain_community.retrievers",+ "GoogleCloudEnterpriseSearchRetriever": "langchain_community.retrievers",+ "GoogleVertexAIMultiTurnSearchRetriever": "langchain_community.retrievers",+ "GoogleVertexAISearchRetriever": "langchain_community.retrievers",+ "KayAiRetriever": "langchain_community.retrievers",+ "KNNRetriever": "langchain_community.retrievers",+ "LlamaIndexGraphRetriever": "langchain_community.retrievers",+ "LlamaIndexRetriever": "langchain_community.retrievers",+ "MetalRetriever": "langchain_community.retrievers",+ "MilvusRetriever": "langchain_community.retrievers",+ "OutlineRetriever": "langchain_community.retrievers",+ "PineconeHybridSearchRetriever": "langchain_community.retrievers",+ "PubMedRetriever": "langchain_community.retrievers",+ "RemoteLangChainRetriever": "langchain_community.retrievers",+ "SVMRetriever": "langchain_community.retrievers",+ "TavilySearchAPIRetriever": "langchain_community.retrievers",+ "TFIDFRetriever": "langchain_community.retrievers",+ "BM25Retriever": "langchain_community.retrievers",+ "VespaRetriever": "langchain_community.retrievers",+ "NeuralDBRetriever": "langchain_community.retrievers",+ "DriaRetriever": "langchain_community.retrievers",+ "WeaviateHybridSearchRetriever": "langchain_community.retrievers",+ "WikipediaRetriever": "langchain_community.retrievers",+ "ZepRetriever": "langchain_community.retrievers",+ "ZillizRetriever": "langchain_community.retrievers",+ "DocArrayRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)def __getattr__(name: str) -> Any:- """Import retrievers from langchain_community."""- return import_lookup(name)+ """Look up attributes dynamically."""+ return _import_attribute(name)__all__ = [@@ -51,14 +133,18 @@ __all__ = ["ArxivRetriever","AzureAISearchRetriever","AzureCognitiveSearchRetriever",- "ChatGPTPluginRetriever",- "ContextualCompressionRetriever",+ "BM25Retriever","ChaindeskRetriever",+ "ChatGPTPluginRetriever","CohereRagRetriever",+ "ContextualCompressionRetriever",+ "DocArrayRetriever",+ "DriaRetriever","ElasticSearchBM25Retriever","EmbedchainRetriever",- "GoogleDocumentAIWarehouseRetriever",+ "EnsembleRetriever","GoogleCloudEnterpriseSearchRetriever",+ "GoogleDocumentAIWarehouseRetriever","GoogleVertexAIMultiTurnSearchRetriever","GoogleVertexAISearchRetriever","KayAiRetriever",@@ -69,25 +155,23 @@ __all__ = ["MetalRetriever","MilvusRetriever","MultiQueryRetriever",+ "MultiVectorRetriever","OutlineRetriever",+ "ParentDocumentRetriever","PineconeHybridSearchRetriever","PubMedRetriever","RemoteLangChainRetriever",- "SVMRetriever",+ "RePhraseQueryRetriever","SelfQueryRetriever",+ "SVMRetriever","TavilySearchAPIRetriever","TFIDFRetriever",- "BM25Retriever","TimeWeightedVectorStoreRetriever","VespaRetriever","WeaviateHybridSearchRetriever",+ "WebResearchRetriever","WikipediaRetriever","ZepRetriever",+ "NeuralDBRetriever","ZillizRetriever",- "DocArrayRetriever",- "RePhraseQueryRetriever",- "WebResearchRetriever",- "EnsembleRetriever",- "ParentDocumentRetriever",- "MultiVectorRetriever",]diff --git a/libs/langchain/langchain/retrievers/arcee.py b/libs/langchain/langchain/retrievers/arcee.pyindex a2f478dfc6..5ba3b56315 100644--- a/libs/langchain/langchain/retrievers/arcee.py+++ b/libs/langchain/langchain/retrievers/arcee.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.arcee import ArceeRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["ArceeRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ArceeRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ArceeRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ArceeRetriever",+]diff --git a/libs/langchain/langchain/retrievers/arxiv.py b/libs/langchain/langchain/retrievers/arxiv.pyindex ae90cdd68e..3fce2d20e9 100644--- a/libs/langchain/langchain/retrievers/arxiv.py+++ b/libs/langchain/langchain/retrievers/arxiv.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.arxiv import ArxivRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["ArxivRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ArxivRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ArxivRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ArxivRetriever",+]diff --git a/libs/langchain/langchain/retrievers/azure_ai_search.py b/libs/langchain/langchain/retrievers/azure_ai_search.pyindex b7c90caa01..fd0615350e 100644--- a/libs/langchain/langchain/retrievers/azure_ai_search.py+++ b/libs/langchain/langchain/retrievers/azure_ai_search.py@@ -1,6 +1,30 @@-from langchain_community.retrievers.azure_ai_search import (- AzureAISearchRetriever,- AzureCognitiveSearchRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["AzureAISearchRetriever", "AzureCognitiveSearchRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import (+ AzureAISearchRetriever,+ AzureCognitiveSearchRetriever,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "AzureAISearchRetriever": "langchain_community.retrievers",+ "AzureCognitiveSearchRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "AzureAISearchRetriever",+ "AzureCognitiveSearchRetriever",+]diff --git a/libs/langchain/langchain/retrievers/bedrock.py b/libs/langchain/langchain/retrievers/bedrock.pyindex cab6684fbd..25558d924b 100644--- a/libs/langchain/langchain/retrievers/bedrock.py+++ b/libs/langchain/langchain/retrievers/bedrock.py@@ -1,7 +1,33 @@-from langchain_community.retrievers.bedrock import (- AmazonKnowledgeBasesRetriever,- RetrievalConfig,- VectorSearchConfig,-)+from typing import TYPE_CHECKING, Any-__all__ = ["VectorSearchConfig", "RetrievalConfig", "AmazonKnowledgeBasesRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import AmazonKnowledgeBasesRetriever+ from langchain_community.retrievers.bedrock import (+ RetrievalConfig,+ VectorSearchConfig,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "VectorSearchConfig": "langchain_community.retrievers.bedrock",+ "RetrievalConfig": "langchain_community.retrievers.bedrock",+ "AmazonKnowledgeBasesRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "VectorSearchConfig",+ "RetrievalConfig",+ "AmazonKnowledgeBasesRetriever",+]diff --git a/libs/langchain/langchain/retrievers/bm25.py b/libs/langchain/langchain/retrievers/bm25.pyindex 78c7285228..e5dc419522 100644--- a/libs/langchain/langchain/retrievers/bm25.py+++ b/libs/langchain/langchain/retrievers/bm25.py@@ -1,6 +1,28 @@-from langchain_community.retrievers.bm25 import (- BM25Retriever,- default_preprocessing_func,-)+from typing import TYPE_CHECKING, Any-__all__ = ["default_preprocessing_func", "BM25Retriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import BM25Retriever+ from langchain_community.retrievers.bm25 import default_preprocessing_func++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "default_preprocessing_func": "langchain_community.retrievers.bm25",+ "BM25Retriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "default_preprocessing_func",+ "BM25Retriever",+]diff --git a/libs/langchain/langchain/retrievers/chaindesk.py b/libs/langchain/langchain/retrievers/chaindesk.pyindex 88085eb90b..a0a9f6eec2 100644--- a/libs/langchain/langchain/retrievers/chaindesk.py+++ b/libs/langchain/langchain/retrievers/chaindesk.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.chaindesk import ChaindeskRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["ChaindeskRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ChaindeskRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChaindeskRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChaindeskRetriever",+]diff --git a/libs/langchain/langchain/retrievers/chatgpt_plugin_retriever.py b/libs/langchain/langchain/retrievers/chatgpt_plugin_retriever.pyindex 314d98455c..6258c4621f 100644--- a/libs/langchain/langchain/retrievers/chatgpt_plugin_retriever.py+++ b/libs/langchain/langchain/retrievers/chatgpt_plugin_retriever.py@@ -1,5 +1,23 @@-from langchain_community.retrievers.chatgpt_plugin_retriever import (- ChatGPTPluginRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ChatGPTPluginRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ChatGPTPluginRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ChatGPTPluginRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ChatGPTPluginRetriever",+]diff --git a/libs/langchain/langchain/retrievers/cohere_rag_retriever.py b/libs/langchain/langchain/retrievers/cohere_rag_retriever.pyindex 560e9957ce..7c2e1bed24 100644--- a/libs/langchain/langchain/retrievers/cohere_rag_retriever.py+++ b/libs/langchain/langchain/retrievers/cohere_rag_retriever.py@@ -1,5 +1,23 @@-from langchain_community.retrievers.cohere_rag_retriever import (- CohereRagRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["CohereRagRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import CohereRagRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"CohereRagRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "CohereRagRetriever",+]diff --git a/libs/langchain/langchain/retrievers/databerry.py b/libs/langchain/langchain/retrievers/databerry.pyindex ecb690898e..3eeca776bf 100644--- a/libs/langchain/langchain/retrievers/databerry.py+++ b/libs/langchain/langchain/retrievers/databerry.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.databerry import DataberryRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["DataberryRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers.databerry import DataberryRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"DataberryRetriever": "langchain_community.retrievers.databerry"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "DataberryRetriever",+]diff --git a/libs/langchain/langchain/retrievers/docarray.py b/libs/langchain/langchain/retrievers/docarray.pyindex 1191adf0e3..7f433c5859 100644--- a/libs/langchain/langchain/retrievers/docarray.py+++ b/libs/langchain/langchain/retrievers/docarray.py@@ -1,3 +1,28 @@-from langchain_community.retrievers.docarray import DocArrayRetriever, SearchType+from typing import TYPE_CHECKING, Any-__all__ = ["SearchType", "DocArrayRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import DocArrayRetriever+ from langchain_community.retrievers.docarray import SearchType++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "SearchType": "langchain_community.retrievers.docarray",+ "DocArrayRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "SearchType",+ "DocArrayRetriever",+]diff --git a/libs/langchain/langchain/retrievers/elastic_search_bm25.py b/libs/langchain/langchain/retrievers/elastic_search_bm25.pyindex 649705438f..52d5ffaea8 100644--- a/libs/langchain/langchain/retrievers/elastic_search_bm25.py+++ b/libs/langchain/langchain/retrievers/elastic_search_bm25.py@@ -1,5 +1,23 @@-from langchain_community.retrievers.elastic_search_bm25 import (- ElasticSearchBM25Retriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["ElasticSearchBM25Retriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ElasticSearchBM25Retriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"ElasticSearchBM25Retriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ElasticSearchBM25Retriever",+]diff --git a/libs/langchain/langchain/retrievers/embedchain.py b/libs/langchain/langchain/retrievers/embedchain.pyindex 92a718e4be..5e2958dbbf 100644--- a/libs/langchain/langchain/retrievers/embedchain.py+++ b/libs/langchain/langchain/retrievers/embedchain.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.embedchain import EmbedchainRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["EmbedchainRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import EmbedchainRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"EmbedchainRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "EmbedchainRetriever",+]diff --git a/libs/langchain/langchain/retrievers/google_cloud_documentai_warehouse.py b/libs/langchain/langchain/retrievers/google_cloud_documentai_warehouse.pyindex 6dc2079f3a..f310037e09 100644--- a/libs/langchain/langchain/retrievers/google_cloud_documentai_warehouse.py+++ b/libs/langchain/langchain/retrievers/google_cloud_documentai_warehouse.py@@ -1,5 +1,25 @@-from langchain_community.retrievers.google_cloud_documentai_warehouse import (- GoogleDocumentAIWarehouseRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["GoogleDocumentAIWarehouseRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import GoogleDocumentAIWarehouseRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "GoogleDocumentAIWarehouseRetriever": "langchain_community.retrievers"+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "GoogleDocumentAIWarehouseRetriever",+]diff --git a/libs/langchain/langchain/retrievers/google_vertex_ai_search.py b/libs/langchain/langchain/retrievers/google_vertex_ai_search.pyindex ffda6696fb..1f8a71de6c 100644--- a/libs/langchain/langchain/retrievers/google_vertex_ai_search.py+++ b/libs/langchain/langchain/retrievers/google_vertex_ai_search.py@@ -1,8 +1,30 @@-from langchain_community.retrievers.google_vertex_ai_search import (- GoogleCloudEnterpriseSearchRetriever,- GoogleVertexAIMultiTurnSearchRetriever,- GoogleVertexAISearchRetriever,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import (+ GoogleCloudEnterpriseSearchRetriever,+ GoogleVertexAIMultiTurnSearchRetriever,+ GoogleVertexAISearchRetriever,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "GoogleVertexAISearchRetriever": "langchain_community.retrievers",+ "GoogleVertexAIMultiTurnSearchRetriever": "langchain_community.retrievers",+ "GoogleCloudEnterpriseSearchRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["GoogleVertexAISearchRetriever",diff --git a/libs/langchain/langchain/retrievers/kay.py b/libs/langchain/langchain/retrievers/kay.pyindex 70cb97be3d..ddc4532326 100644--- a/libs/langchain/langchain/retrievers/kay.py+++ b/libs/langchain/langchain/retrievers/kay.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.kay import KayAiRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["KayAiRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import KayAiRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"KayAiRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "KayAiRetriever",+]diff --git a/libs/langchain/langchain/retrievers/kendra.py b/libs/langchain/langchain/retrievers/kendra.pyindex 1adc2fd6bb..824c6569cf 100644--- a/libs/langchain/langchain/retrievers/kendra.py+++ b/libs/langchain/langchain/retrievers/kendra.py@@ -1,25 +1,56 @@-from langchain_community.retrievers.kendra import (- AdditionalResultAttribute,- AdditionalResultAttributeValue,- AmazonKendraRetriever,- DocumentAttribute,- DocumentAttributeValue,- DocumentAttributeValueType,- Highlight,- QueryResult,- QueryResultItem,- ResultItem,- RetrieveResult,- RetrieveResultItem,- TextWithHighLights,- clean_excerpt,- combined_text,-)+from typing import TYPE_CHECKING, Any++from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import AmazonKendraRetriever+ from langchain_community.retrievers.kendra import (+ AdditionalResultAttribute,+ AdditionalResultAttributeValue,+ DocumentAttribute,+ DocumentAttributeValue,+ Highlight,+ QueryResult,+ QueryResultItem,+ ResultItem,+ RetrieveResult,+ RetrieveResultItem,+ TextWithHighLights,+ clean_excerpt,+ combined_text,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "clean_excerpt": "langchain_community.retrievers.kendra",+ "combined_text": "langchain_community.retrievers.kendra",+ "Highlight": "langchain_community.retrievers.kendra",+ "TextWithHighLights": "langchain_community.retrievers.kendra",+ "AdditionalResultAttributeValue": "langchain_community.retrievers.kendra",+ "AdditionalResultAttribute": "langchain_community.retrievers.kendra",+ "DocumentAttributeValue": "langchain_community.retrievers.kendra",+ "DocumentAttribute": "langchain_community.retrievers.kendra",+ "ResultItem": "langchain_community.retrievers.kendra",+ "QueryResultItem": "langchain_community.retrievers.kendra",+ "RetrieveResultItem": "langchain_community.retrievers.kendra",+ "QueryResult": "langchain_community.retrievers.kendra",+ "RetrieveResult": "langchain_community.retrievers.kendra",+ "AmazonKendraRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+__all__ = ["clean_excerpt","combined_text",- "DocumentAttributeValueType","Highlight","TextWithHighLights","AdditionalResultAttributeValue",diff --git a/libs/langchain/langchain/retrievers/knn.py b/libs/langchain/langchain/retrievers/knn.pyindex 7165eb9ca6..6e10d9a70d 100644--- a/libs/langchain/langchain/retrievers/knn.py+++ b/libs/langchain/langchain/retrievers/knn.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.knn import KNNRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["KNNRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import KNNRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"KNNRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "KNNRetriever",+]diff --git a/libs/langchain/langchain/retrievers/llama_index.py b/libs/langchain/langchain/retrievers/llama_index.pyindex 939e81a901..a86b9e0d3d 100644--- a/libs/langchain/langchain/retrievers/llama_index.py+++ b/libs/langchain/langchain/retrievers/llama_index.py@@ -1,6 +1,30 @@-from langchain_community.retrievers.llama_index import (- LlamaIndexGraphRetriever,- LlamaIndexRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["LlamaIndexRetriever", "LlamaIndexGraphRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import (+ LlamaIndexGraphRetriever,+ LlamaIndexRetriever,+ )++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "LlamaIndexRetriever": "langchain_community.retrievers",+ "LlamaIndexGraphRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "LlamaIndexRetriever",+ "LlamaIndexGraphRetriever",+]diff --git a/libs/langchain/langchain/retrievers/metal.py b/libs/langchain/langchain/retrievers/metal.pyindex a38f89e177..9d4927de53 100644--- a/libs/langchain/langchain/retrievers/metal.py+++ b/libs/langchain/langchain/retrievers/metal.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.metal import MetalRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["MetalRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import MetalRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"MetalRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "MetalRetriever",+]diff --git a/libs/langchain/langchain/retrievers/milvus.py b/libs/langchain/langchain/retrievers/milvus.pyindex 261b7e2a80..bd9fd8536b 100644--- a/libs/langchain/langchain/retrievers/milvus.py+++ b/libs/langchain/langchain/retrievers/milvus.py@@ -1,3 +1,28 @@-from langchain_community.retrievers.milvus import MilvusRetreiver, MilvusRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["MilvusRetriever", "MilvusRetreiver"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import MilvusRetriever+ from langchain_community.retrievers.milvus import MilvusRetreiver++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "MilvusRetriever": "langchain_community.retrievers",+ "MilvusRetreiver": "langchain_community.retrievers.milvus",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "MilvusRetriever",+ "MilvusRetreiver",+]diff --git a/libs/langchain/langchain/retrievers/outline.py b/libs/langchain/langchain/retrievers/outline.pyindex efcd9e6ad6..be0e4451b8 100644--- a/libs/langchain/langchain/retrievers/outline.py+++ b/libs/langchain/langchain/retrievers/outline.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.outline import OutlineRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["OutlineRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import OutlineRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"OutlineRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "OutlineRetriever",+]diff --git a/libs/langchain/langchain/retrievers/pinecone_hybrid_search.py b/libs/langchain/langchain/retrievers/pinecone_hybrid_search.pyindex bd1fa64ee4..e27acd052c 100644--- a/libs/langchain/langchain/retrievers/pinecone_hybrid_search.py+++ b/libs/langchain/langchain/retrievers/pinecone_hybrid_search.py@@ -1,5 +1,23 @@-from langchain_community.retrievers.pinecone_hybrid_search import (- PineconeHybridSearchRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["PineconeHybridSearchRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import PineconeHybridSearchRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"PineconeHybridSearchRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "PineconeHybridSearchRetriever",+]diff --git a/libs/langchain/langchain/retrievers/pubmed.py b/libs/langchain/langchain/retrievers/pubmed.pyindex 7fed1277fa..ae03d4b1e2 100644--- a/libs/langchain/langchain/retrievers/pubmed.py+++ b/libs/langchain/langchain/retrievers/pubmed.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.pubmed import PubMedRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["PubMedRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import PubMedRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"PubMedRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "PubMedRetriever",+]diff --git a/libs/langchain/langchain/retrievers/pupmed.py b/libs/langchain/langchain/retrievers/pupmed.pyindex 3104dac6f4..0d1029f516 100644--- a/libs/langchain/langchain/retrievers/pupmed.py+++ b/libs/langchain/langchain/retrievers/pupmed.py@@ -1,5 +1,24 @@+from typing import TYPE_CHECKING, Any++from langchain._api import create_importerfrom langchain.retrievers.pubmed import PubMedRetriever+if TYPE_CHECKING:+ from langchain_community.retrievers import PubMedRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"PubMedRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)++__all__ = ["PubMedRetriever",]diff --git a/libs/langchain/langchain/retrievers/remote_retriever.py b/libs/langchain/langchain/retrievers/remote_retriever.pyindex fcb60c9a3a..d8384e2d43 100644--- a/libs/langchain/langchain/retrievers/remote_retriever.py+++ b/libs/langchain/langchain/retrievers/remote_retriever.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.remote_retriever import RemoteLangChainRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["RemoteLangChainRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import RemoteLangChainRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"RemoteLangChainRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "RemoteLangChainRetriever",+]diff --git a/libs/langchain/langchain/retrievers/svm.py b/libs/langchain/langchain/retrievers/svm.pyindex 2e0d8b669a..4b50d5d56c 100644--- a/libs/langchain/langchain/retrievers/svm.py+++ b/libs/langchain/langchain/retrievers/svm.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.svm import SVMRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["SVMRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import SVMRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"SVMRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "SVMRetriever",+]diff --git a/libs/langchain/langchain/retrievers/tavily_search_api.py b/libs/langchain/langchain/retrievers/tavily_search_api.pyindex 6fc2bca602..fba6f611ed 100644--- a/libs/langchain/langchain/retrievers/tavily_search_api.py+++ b/libs/langchain/langchain/retrievers/tavily_search_api.py@@ -1,6 +1,28 @@-from langchain_community.retrievers.tavily_search_api import (- SearchDepth,- TavilySearchAPIRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["SearchDepth", "TavilySearchAPIRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import TavilySearchAPIRetriever+ from langchain_community.retrievers.tavily_search_api import SearchDepth++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "SearchDepth": "langchain_community.retrievers.tavily_search_api",+ "TavilySearchAPIRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "SearchDepth",+ "TavilySearchAPIRetriever",+]diff --git a/libs/langchain/langchain/retrievers/tfidf.py b/libs/langchain/langchain/retrievers/tfidf.pyindex 0cefc03c2b..d7c36a32c9 100644--- a/libs/langchain/langchain/retrievers/tfidf.py+++ b/libs/langchain/langchain/retrievers/tfidf.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.tfidf import TFIDFRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["TFIDFRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import TFIDFRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"TFIDFRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "TFIDFRetriever",+]diff --git a/libs/langchain/langchain/retrievers/vespa_retriever.py b/libs/langchain/langchain/retrievers/vespa_retriever.pyindex 889668853b..04065ba16e 100644--- a/libs/langchain/langchain/retrievers/vespa_retriever.py+++ b/libs/langchain/langchain/retrievers/vespa_retriever.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.vespa_retriever import VespaRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["VespaRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import VespaRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"VespaRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "VespaRetriever",+]diff --git a/libs/langchain/langchain/retrievers/weaviate_hybrid_search.py b/libs/langchain/langchain/retrievers/weaviate_hybrid_search.pyindex bd15f128e5..51e468cd64 100644--- a/libs/langchain/langchain/retrievers/weaviate_hybrid_search.py+++ b/libs/langchain/langchain/retrievers/weaviate_hybrid_search.py@@ -1,5 +1,23 @@-from langchain_community.retrievers.weaviate_hybrid_search import (- WeaviateHybridSearchRetriever,-)+from typing import TYPE_CHECKING, Any-__all__ = ["WeaviateHybridSearchRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import WeaviateHybridSearchRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"WeaviateHybridSearchRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "WeaviateHybridSearchRetriever",+]diff --git a/libs/langchain/langchain/retrievers/wikipedia.py b/libs/langchain/langchain/retrievers/wikipedia.pyindex 8eaffa85b9..23ce07338e 100644--- a/libs/langchain/langchain/retrievers/wikipedia.py+++ b/libs/langchain/langchain/retrievers/wikipedia.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.wikipedia import WikipediaRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["WikipediaRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import WikipediaRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"WikipediaRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "WikipediaRetriever",+]diff --git a/libs/langchain/langchain/retrievers/you.py b/libs/langchain/langchain/retrievers/you.pyindex c285b56263..5267e940c8 100644--- a/libs/langchain/langchain/retrievers/you.py+++ b/libs/langchain/langchain/retrievers/you.py@@ -1,3 +1,23 @@-from langchain_community.retrievers.you import YouRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["YouRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import YouRetriever++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {"YouRetriever": "langchain_community.retrievers"}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "YouRetriever",+]diff --git a/libs/langchain/langchain/retrievers/zep.py b/libs/langchain/langchain/retrievers/zep.pyindex 9f09841bd6..ade5e59e2e 100644--- a/libs/langchain/langchain/retrievers/zep.py+++ b/libs/langchain/langchain/retrievers/zep.py@@ -1,3 +1,30 @@-from langchain_community.retrievers.zep import SearchScope, SearchType, ZepRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["SearchScope", "SearchType", "ZepRetriever"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ZepRetriever+ from langchain_community.retrievers.zep import SearchScope, SearchType++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "SearchScope": "langchain_community.retrievers.zep",+ "SearchType": "langchain_community.retrievers.zep",+ "ZepRetriever": "langchain_community.retrievers",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "SearchScope",+ "SearchType",+ "ZepRetriever",+]diff --git a/libs/langchain/langchain/retrievers/zilliz.py b/libs/langchain/langchain/retrievers/zilliz.pyindex 8daf25f61c..3b07c57c3b 100644--- a/libs/langchain/langchain/retrievers/zilliz.py+++ b/libs/langchain/langchain/retrievers/zilliz.py@@ -1,3 +1,28 @@-from langchain_community.retrievers.zilliz import ZillizRetreiver, ZillizRetriever+from typing import TYPE_CHECKING, Any-__all__ = ["ZillizRetriever", "ZillizRetreiver"]+from langchain._api import create_importer++if TYPE_CHECKING:+ from langchain_community.retrievers import ZillizRetriever+ from langchain_community.retrievers.zilliz import ZillizRetreiver++# Create a way to dynamically look up deprecated imports.+# Used to consolidate logic for raising deprecation warnings and+# handling optional imports.+DEPRECATED_LOOKUP = {+ "ZillizRetriever": "langchain_community.retrievers",+ "ZillizRetreiver": "langchain_community.retrievers.zilliz",+}++_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)+++def __getattr__(name: str) -> Any:+ """Look up attributes dynamically."""+ return _import_attribute(name)+++__all__ = [+ "ZillizRetriever",+ "ZillizRetreiver",+]diff --git a/libs/langchain/tests/unit_tests/retrievers/test_imports.py b/libs/langchain/tests/unit_tests/retrievers/test_imports.pyindex 0125b0f421..935f62bfa2 100644--- a/libs/langchain/tests/unit_tests/retrievers/test_imports.py+++ b/libs/langchain/tests/unit_tests/retrievers/test_imports.py@@ -8,14 +8,18 @@ EXPECTED_ALL = ["ArxivRetriever","AzureAISearchRetriever","AzureCognitiveSearchRetriever",- "ChatGPTPluginRetriever",- "ContextualCompressionRetriever",+ "BM25Retriever","ChaindeskRetriever",+ "ChatGPTPluginRetriever","CohereRagRetriever",+ "ContextualCompressionRetriever",+ "DocArrayRetriever",+ "DriaRetriever","ElasticSearchBM25Retriever","EmbedchainRetriever",- "GoogleDocumentAIWarehouseRetriever",+ "EnsembleRetriever","GoogleCloudEnterpriseSearchRetriever",+ "GoogleDocumentAIWarehouseRetriever","GoogleVertexAIMultiTurnSearchRetriever","GoogleVertexAISearchRetriever","KayAiRetriever",@@ -26,27 +30,25 @@ EXPECTED_ALL = ["MetalRetriever","MilvusRetriever","MultiQueryRetriever",+ "MultiVectorRetriever",+ "NeuralDBRetriever","OutlineRetriever",+ "ParentDocumentRetriever","PineconeHybridSearchRetriever","PubMedRetriever","RemoteLangChainRetriever",- "SVMRetriever",+ "RePhraseQueryRetriever","SelfQueryRetriever",+ "SVMRetriever","TavilySearchAPIRetriever","TFIDFRetriever",- "BM25Retriever","TimeWeightedVectorStoreRetriever","VespaRetriever","WeaviateHybridSearchRetriever",+ "WebResearchRetriever","WikipediaRetriever","ZepRetriever","ZillizRetriever",- "DocArrayRetriever",- "RePhraseQueryRetriever",- "WebResearchRetriever",- "EnsembleRetriever",- "ParentDocumentRetriever",- "MultiVectorRetriever",]