mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-15 05:59:59 +00:00
feat(rag): Support RAG SDK (#1322)
This commit is contained in:
@@ -1,23 +1,50 @@
|
||||
"""Module Of Knowledge."""
|
||||
|
||||
from .base import ChunkStrategy, Knowledge, KnowledgeType # noqa: F401
|
||||
from .csv import CSVKnowledge # noqa: F401
|
||||
from .docx import DocxKnowledge # noqa: F401
|
||||
from .factory import KnowledgeFactory # noqa: F401
|
||||
from .html import HTMLKnowledge # noqa: F401
|
||||
from .markdown import MarkdownKnowledge # noqa: F401
|
||||
from .pdf import PDFKnowledge # noqa: F401
|
||||
from .pptx import PPTXKnowledge # noqa: F401
|
||||
from .string import StringKnowledge # noqa: F401
|
||||
from .txt import TXTKnowledge # noqa: F401
|
||||
from .url import URLKnowledge # noqa: F401
|
||||
from typing import Any, Dict
|
||||
|
||||
__ALL__ = [
|
||||
_MODULE_CACHE: Dict[str, Any] = {}
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
# Lazy load
|
||||
import importlib
|
||||
|
||||
if name in _MODULE_CACHE:
|
||||
return _MODULE_CACHE[name]
|
||||
|
||||
_LIBS = {
|
||||
"KnowledgeFactory": "factory",
|
||||
"Knowledge": "base",
|
||||
"KnowledgeType": "base",
|
||||
"ChunkStrategy": "base",
|
||||
"CSVKnowledge": "csv",
|
||||
"DatasourceKnowledge": "datasource",
|
||||
"DocxKnowledge": "docx",
|
||||
"HTMLKnowledge": "html",
|
||||
"MarkdownKnowledge": "markdown",
|
||||
"PDFKnowledge": "pdf",
|
||||
"PPTXKnowledge": "pptx",
|
||||
"StringKnowledge": "string",
|
||||
"TXTKnowledge": "txt",
|
||||
"URLKnowledge": "url",
|
||||
}
|
||||
|
||||
if name in _LIBS:
|
||||
module_path = "." + _LIBS[name]
|
||||
module = importlib.import_module(module_path, __name__)
|
||||
attr = getattr(module, name)
|
||||
_MODULE_CACHE[name] = attr
|
||||
return attr
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
|
||||
__all__ = [
|
||||
"KnowledgeFactory",
|
||||
"Knowledge",
|
||||
"KnowledgeType",
|
||||
"ChunkStrategy",
|
||||
"CSVKnowledge",
|
||||
"DatasourceKnowledge",
|
||||
"DocxKnowledge",
|
||||
"HTMLKnowledge",
|
||||
"MarkdownKnowledge",
|
||||
|
Reference in New Issue
Block a user