Files
DB-GPT/dbgpt/storage/knowledge_graph/base.py
Florian a9087c3853 feat: add GraphRAG framework and integrate TuGraph (#1506)
Co-authored-by: KingSkyLi <15566300566@163.com>
Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
2024-05-16 15:39:50 +08:00

29 lines
830 B
Python

"""Knowledge graph base class."""
import logging
from abc import ABC, abstractmethod
from typing import Optional
from dbgpt._private.pydantic import ConfigDict
from dbgpt.rag.index.base import IndexStoreBase, IndexStoreConfig
from dbgpt.storage.graph_store.graph import Graph
logger = logging.getLogger(__name__)
class KnowledgeGraphConfig(IndexStoreConfig):
"""Knowledge graph config."""
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
class KnowledgeGraphBase(IndexStoreBase, ABC):
"""Knowledge graph base class."""
@abstractmethod
def query_graph(self, limit: Optional[int] = None) -> Graph:
"""Get graph data."""
def delete_by_ids(self, ids: str):
"""Delete document by ids."""
raise Exception("Delete document not supported by knowledge graph")