mirror of https://github.com/hwchase17/langchain
langchain[patch]: Upgrade storage to treat langchain community as optional (#21105)
parent
ab55f6996d
commit
2fcab9acd9
@ -1,3 +1,23 @@
|
||||
from langchain_community.storage.redis import RedisStore
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["RedisStore"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.storage import RedisStore
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {"RedisStore": "langchain_community.storage"}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"RedisStore",
|
||||
]
|
||||
|
@ -1,6 +1,27 @@
|
||||
from langchain_community.storage.upstash_redis import (
|
||||
UpstashRedisByteStore,
|
||||
UpstashRedisStore,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
__all__ = ["UpstashRedisStore", "UpstashRedisByteStore"]
|
||||
from langchain._api import create_importer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_community.storage import UpstashRedisByteStore, UpstashRedisStore
|
||||
|
||||
# Create a way to dynamically look up deprecated imports.
|
||||
# Used to consolidate logic for raising deprecation warnings and
|
||||
# handling optional imports.
|
||||
DEPRECATED_LOOKUP = {
|
||||
"UpstashRedisStore": "langchain_community.storage",
|
||||
"UpstashRedisByteStore": "langchain_community.storage",
|
||||
}
|
||||
|
||||
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
"""Look up attributes dynamically."""
|
||||
return _import_attribute(name)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"UpstashRedisStore",
|
||||
"UpstashRedisByteStore",
|
||||
]
|
||||
|
Loading…
Reference in New Issue