codekingpro/portable-devtools
114k
1"""**Docstores** are classes to store and load Documents.2 3The **Docstore** is a simplified version of the Document Loader.4 5**Class hierarchy:**6 7.. code-block::8 9 Docstore --> <name> # Examples: InMemoryDocstore, Wikipedia10 11**Main helpers:**12 13.. code-block::14 15 Document, AddableMixin16"""17 18import importlib19from typing import TYPE_CHECKING, Any20 21if TYPE_CHECKING:22 from langchain_community.docstore.arbitrary_fn import (23 DocstoreFn,24 )25 from langchain_community.docstore.in_memory import (26 InMemoryDocstore,27 )28 from langchain_community.docstore.wikipedia import (29 Wikipedia,30 )31 32_module_lookup = {33 "DocstoreFn": "langchain_community.docstore.arbitrary_fn",34 "InMemoryDocstore": "langchain_community.docstore.in_memory",35 "Wikipedia": "langchain_community.docstore.wikipedia",36}37 38 39def __getattr__(name: str) -> Any:40 if name in _module_lookup:41 module = importlib.import_module(_module_lookup[name])42 return getattr(module, name)43 raise AttributeError(f"module {__name__} has no attribute {name}")44 45 46__all__ = ["DocstoreFn", "InMemoryDocstore", "Wikipedia"]47 