mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-15 14:11:14 +00:00
feat(ChatKnowledge): Support Financial Report Analysis (#1702)
Co-authored-by: hzh97 <2976151305@qq.com> Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: licunxing <864255598@qq.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from dbgpt.rag.knowledge.factory import KnowledgeFactory
|
||||
|
||||
_MODULE_CACHE: Dict[str, Any] = {}
|
||||
|
||||
|
||||
|
@@ -35,6 +35,8 @@ class KnowledgeType(Enum):
|
||||
DOCUMENT = "DOCUMENT"
|
||||
URL = "URL"
|
||||
TEXT = "TEXT"
|
||||
# TODO: Remove this type
|
||||
FIN_REPORT = "FIN_REPORT"
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
@@ -163,6 +165,10 @@ class Knowledge(ABC):
|
||||
documents = self._load()
|
||||
return self._postprocess(documents)
|
||||
|
||||
def extract(self, documents: List[Document]) -> List[Document]:
|
||||
"""Extract knowledge from text."""
|
||||
return documents
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def type(cls) -> KnowledgeType:
|
||||
@@ -177,6 +183,11 @@ class Knowledge(ABC):
|
||||
"""Post process knowledge from data loader."""
|
||||
return docs
|
||||
|
||||
@property
|
||||
def file_path(self):
|
||||
"""Get file path."""
|
||||
return self._path
|
||||
|
||||
@abstractmethod
|
||||
def _load(self) -> List[Document]:
|
||||
"""Preprocess knowledge from data loader."""
|
||||
|
Reference in New Issue
Block a user