mirror of https://github.com/hwchase17/langchain
langchain[patch]: Update more code to use langchain community as an optional dependency (#21170)
More code to use langchain community as an optional dependencypull/21194/head
parent
cd4c54282a
commit
c306364b06
@ -1,3 +1,27 @@
|
||||
from langchain_community.document_loaders.parsers.language.python import PythonSegmenter
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["PythonSegmenter"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.document_loaders.parsers.language.python import (
|
||||
PythonSegmenter,
|
||||
)
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"PythonSegmenter": "langchain_community.document_loaders.parsers.language.python"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"PythonSegmenter",
|
||||
]
|
||||
|
@ -1,5 +1,26 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.document_loaders.pyspark_dataframe import (
|
||||
PySparkDataFrameLoader,
|
||||
)
|
||||
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"PySparkDataFrameLoader": "langchain_community.document_loaders.pyspark_dataframe"
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["PySparkDataFrameLoader"]
|
||||
|
@ -1,3 +1,22 @@
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.document_loaders.python import PythonLoader
|
||||
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"PythonLoader": "langchain_community.document_loaders.python"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["PythonLoader"]
|
||||
|
@ -1,5 +1,21 @@
|
||||
from langchain_community.embeddings.sentence_transformer import (
|
||||
SentenceTransformerEmbeddings,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.embeddings import SentenceTransformerEmbeddings
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"SentenceTransformerEmbeddings": "langchain_community.embeddings"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["SentenceTransformerEmbeddings"]
|
||||
|
@ -1,5 +1,27 @@
|
||||
"""Graph Index Creator."""
|
||||
"""**Graphs** provide a natural language interface to graph databases."""
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.graphs.index_creator import GraphIndexCreator
|
||||
from langchain_community.graphs.networkx_graph import NetworkxEntityGraph
|
||||
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"GraphIndexCreator": "langchain_community.graphs.index_creator",
|
||||
"NetworkxEntityGraph": "langchain_community.graphs.networkx_graph",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = ["GraphIndexCreator", "NetworkxEntityGraph"]
|
||||
|
@ -1,3 +1,23 @@
|
||||
from langchain_community.llms.titan_takeoff import TitanTakeoff as TitanTakeoffPro
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["TitanTakeoffPro"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.llms import TitanTakeoffPro
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"TitanTakeoffPro": "langchain_community.llms"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"TitanTakeoffPro",
|
||||
]
|
||||
|
@ -1,4 +1,21 @@
|
||||
"""For backwards compatibility."""
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.utilities.python import PythonREPL
|
||||
|
||||
|
||||
_importer = create_importer(
|
||||
__package__,
|
||||
deprecated_lookups={"PythonREPL": "langchain_community.utilities.python"},
|
||||
)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _importer(name)
|
||||
|
||||
|
||||
__all__ = ["PythonREPL"]
|
||||
|
@ -1,7 +0,0 @@
|
||||
from langchain_community.tools.ainetwork.app import (
|
||||
AINAppOps,
|
||||
AppOperationType,
|
||||
AppSchema,
|
||||
)
|
||||
|
||||
__all__ = ["AppOperationType", "AppSchema", "AINAppOps"]
|
@ -1,3 +0,0 @@
|
||||
from langchain_community.tools.ainetwork.base import AINBaseTool, OperationType
|
||||
|
||||
__all__ = ["OperationType", "AINBaseTool"]
|
@ -1,3 +0,0 @@
|
||||
from langchain_community.tools.ainetwork.owner import AINOwnerOps, RuleSchema
|
||||
|
||||
__all__ = ["RuleSchema", "AINOwnerOps"]
|
@ -1,3 +0,0 @@
|
||||
from langchain_community.tools.ainetwork.rule import AINRuleOps, RuleSchema
|
||||
|
||||
__all__ = ["RuleSchema", "AINRuleOps"]
|
@ -1,3 +0,0 @@
|
||||
from langchain_community.tools.ainetwork.transfer import AINTransfer, TransferSchema
|
||||
|
||||
__all__ = ["TransferSchema", "AINTransfer"]
|
@ -1,3 +0,0 @@
|
||||
from langchain_community.tools.ainetwork.value import AINValueOps, ValueSchema
|
||||
|
||||
__all__ = ["ValueSchema", "AINValueOps"]
|
@ -1,3 +1,23 @@
|
||||
"""For backwards compatibility."""
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.tools.sql_database.prompt import QUERY_CHECKER
|
||||
|
||||
|
||||
_importer = create_importer(
|
||||
__package__,
|
||||
deprecated_lookups={
|
||||
"QUERY_CHECKER": "langchain_community.tools.sql_database.prompt",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _importer(name)
|
||||
|
||||
|
||||
__all__ = ["QUERY_CHECKER"]
|
||||
|
@ -1,3 +1,21 @@
|
||||
"""For backwards compatibility."""
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.utilities.python import PythonREPL
|
||||
|
||||
|
||||
_importer = create_importer(
|
||||
__package__,
|
||||
deprecated_lookups={"PythonREPL": "langchain_community.utilities.python"},
|
||||
)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _importer(name)
|
||||
|
||||
|
||||
__all__ = ["PythonREPL"]
|
||||
|
Loading…
Reference in New Issue