langchain/libs/community/langchain_community/docstore/__init__.py
Leonid Ganeline 11195cfa42
community[patch]: speed up import times in the community package (#18928)
This PR speeds up import times in the community package
2024-03-11 16:37:36 -04:00

36 lines
826 B
Python

"""**Docstores** are classes to store and load Documents.
The **Docstore** is a simplified version of the Document Loader.
**Class hierarchy:**
.. code-block::
Docstore --> <name> # Examples: InMemoryDocstore, Wikipedia
**Main helpers:**
.. code-block::
Document, AddableMixin
"""
import importlib
from typing import Any
_module_lookup = {
"DocstoreFn": "langchain_community.docstore.arbitrary_fn",
"InMemoryDocstore": "langchain_community.docstore.in_memory",
"Wikipedia": "langchain_community.docstore.wikipedia",
}
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}")
__all__ = list(_module_lookup.keys())