langchain[minor]: Re-add deleted ainetwork tool (#21254)

* Adding __init__.py to turn it into a package in community
* Adding proxy imports that assume that langchain_community is optional
This commit is contained in:
Eugene Yurtsev 2024-05-03 11:39:40 -04:00 committed by GitHub
parent 2fbe82f5e6
commit 0989c48028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 169 additions and 0 deletions

View File

@ -0,0 +1,30 @@
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import AINAppOps
from langchain_community.tools.ainetwork.app import AppOperationType, AppSchema
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"AppOperationType": "langchain_community.tools.ainetwork.app",
"AppSchema": "langchain_community.tools.ainetwork.app",
"AINAppOps": "langchain_community.tools",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"AppOperationType",
"AppSchema",
"AINAppOps",
]

View File

@ -0,0 +1,27 @@
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools.ainetwork.base import AINBaseTool, OperationType
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"OperationType": "langchain_community.tools.ainetwork.base",
"AINBaseTool": "langchain_community.tools.ainetwork.base",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"OperationType",
"AINBaseTool",
]

View File

@ -0,0 +1,28 @@
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import AINOwnerOps
from langchain_community.tools.ainetwork.owner import RuleSchema
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"RuleSchema": "langchain_community.tools.ainetwork.owner",
"AINOwnerOps": "langchain_community.tools",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"RuleSchema",
"AINOwnerOps",
]

View File

@ -0,0 +1,28 @@
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import AINRuleOps
from langchain_community.tools.ainetwork.rule import RuleSchema
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"RuleSchema": "langchain_community.tools.ainetwork.rule",
"AINRuleOps": "langchain_community.tools",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"RuleSchema",
"AINRuleOps",
]

View File

@ -0,0 +1,28 @@
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import AINTransfer
from langchain_community.tools.ainetwork.transfer import TransferSchema
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"TransferSchema": "langchain_community.tools.ainetwork.transfer",
"AINTransfer": "langchain_community.tools",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"TransferSchema",
"AINTransfer",
]

View File

@ -0,0 +1,28 @@
from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.tools import AINValueOps
from langchain_community.tools.ainetwork.value import ValueSchema
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"ValueSchema": "langchain_community.tools.ainetwork.value",
"AINValueOps": "langchain_community.tools",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
def __getattr__(name: str) -> Any:
"""Look up attributes dynamically."""
return _import_attribute(name)
__all__ = [
"ValueSchema",
"AINValueOps",
]