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:
Aries-ckt
2024-07-26 13:40:54 +08:00
committed by GitHub
parent 22e0680a6a
commit 167d972093
160 changed files with 89339 additions and 795 deletions

View File

@@ -2,6 +2,8 @@
from typing import Any, Dict
from dbgpt.rag.knowledge.factory import KnowledgeFactory
_MODULE_CACHE: Dict[str, Any] = {}

View File

@@ -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."""