-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
langchain[patch]: Migrate retrievers to use optional langchain commun…
…ity imports (#21155)
- Loading branch information
Showing
38 changed files
with
1,000 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
] |
Oops, something went wrong.