mirror of
https://github.com/hwchase17/langchain
synced 2024-11-02 09:40:22 +00:00
9aabb446c5
Hello @eyurtsev - package: langchain-comminity - **Description**: Add SQL implementation for docstore. A new implementation, in line with my other PR ([async PGVector](https://github.com/langchain-ai/langchain-postgres/pull/32), [SQLChatMessageMemory](https://github.com/langchain-ai/langchain/pull/22065)) - Twitter handler: pprados --------- Signed-off-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Piotr Mardziel <piotrm@gmail.com> Co-authored-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
70 lines
1.9 KiB
Python
70 lines
1.9 KiB
Python
"""**Storage** is an implementation of key-value store.
|
|
|
|
Storage module provides implementations of various key-value stores that conform
|
|
to a simple key-value interface.
|
|
|
|
The primary goal of these storages is to support caching.
|
|
|
|
|
|
**Class hierarchy:**
|
|
|
|
.. code-block::
|
|
|
|
BaseStore --> <name>Store # Examples: MongoDBStore, RedisStore
|
|
|
|
"""
|
|
|
|
import importlib
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
if TYPE_CHECKING:
|
|
from langchain_community.storage.astradb import (
|
|
AstraDBByteStore,
|
|
AstraDBStore,
|
|
)
|
|
from langchain_community.storage.cassandra import (
|
|
CassandraByteStore,
|
|
)
|
|
from langchain_community.storage.mongodb import (
|
|
MongoDBStore,
|
|
)
|
|
from langchain_community.storage.redis import (
|
|
RedisStore,
|
|
)
|
|
from langchain_community.storage.sql import (
|
|
SQLStore,
|
|
)
|
|
from langchain_community.storage.upstash_redis import (
|
|
UpstashRedisByteStore,
|
|
UpstashRedisStore,
|
|
)
|
|
|
|
__all__ = [
|
|
"AstraDBByteStore",
|
|
"AstraDBStore",
|
|
"CassandraByteStore",
|
|
"MongoDBStore",
|
|
"RedisStore",
|
|
"SQLStore",
|
|
"UpstashRedisByteStore",
|
|
"UpstashRedisStore",
|
|
]
|
|
|
|
_module_lookup = {
|
|
"AstraDBByteStore": "langchain_community.storage.astradb",
|
|
"AstraDBStore": "langchain_community.storage.astradb",
|
|
"CassandraByteStore": "langchain_community.storage.cassandra",
|
|
"MongoDBStore": "langchain_community.storage.mongodb",
|
|
"RedisStore": "langchain_community.storage.redis",
|
|
"SQLStore": "langchain_community.storage.sql",
|
|
"UpstashRedisByteStore": "langchain_community.storage.upstash_redis",
|
|
"UpstashRedisStore": "langchain_community.storage.upstash_redis",
|
|
}
|
|
|
|
|
|
def __getattr__(name: str) -> Any:
|
|
if name in _module_lookup:
|
|
module = importlib.import_module(_module_lookup[name])
|
|
return getattr(module, name)
|
|
raise AttributeError(f"module {__name__} has no attribute {name}")
|