Refactor before imporve knowledge base.
This commit is contained in:
@@ -47,6 +47,17 @@ class KnowledgeObject(ABC):
|
||||
|
||||
def get_body(self) -> dict:
|
||||
return self.body
|
||||
|
||||
def get_summary(self) -> str:
|
||||
return self.desc.get("summary")
|
||||
|
||||
def get_articl_catelog(self) -> str:
|
||||
assert self.object_type == ObjectType.Document
|
||||
return self.desc.get("catelog")
|
||||
|
||||
def get_article_full_content(self) -> str:
|
||||
assert self.object_type == ObjectType.Document
|
||||
return self.body
|
||||
|
||||
def calculate_id(self):
|
||||
# Convert the object_type and desc to string and compute the SHA256 hash
|
||||
|
||||
@@ -6,6 +6,8 @@ from .vector import ChromaVectorStore, VectorBase
|
||||
import logging
|
||||
|
||||
|
||||
|
||||
|
||||
# KnowledgeStore class, which aggregates ChunkStore, ChunkTracker, and ObjectStore, and is a global singleton that makes it easy to use these three built-in store examples
|
||||
class KnowledgeStore:
|
||||
_instance = None
|
||||
@@ -41,6 +43,8 @@ class KnowledgeStore:
|
||||
self.chunk_list_writer = ChunkListWriter(self.chunk_store, self.chunk_tracker)
|
||||
self.chunk_reader = ChunkReader(self.chunk_store, self.chunk_tracker)
|
||||
self.vector_store = {}
|
||||
|
||||
|
||||
|
||||
def get_relation_store(self) -> ObjectRelationStore:
|
||||
return self.relation_store
|
||||
|
||||
Reference in New Issue
Block a user