mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-28 21:12:13 +00:00
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>
This commit is contained in:
49
dbgpt/storage/knowledge_graph/open_spg.py
Normal file
49
dbgpt/storage/knowledge_graph/open_spg.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""OpenSPG class."""
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
|
||||
from dbgpt._private.pydantic import ConfigDict
|
||||
from dbgpt.core import Chunk
|
||||
from dbgpt.storage.graph_store.graph import Graph, MemoryGraph
|
||||
from dbgpt.storage.knowledge_graph.base import KnowledgeGraphBase, KnowledgeGraphConfig
|
||||
from dbgpt.storage.vector_store.filters import MetadataFilters
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenSPGConfig(KnowledgeGraphConfig):
|
||||
"""OpenSPG config."""
|
||||
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
|
||||
class OpenSPG(KnowledgeGraphBase):
|
||||
"""OpenSPG class."""
|
||||
|
||||
# todo: add OpenSPG implementation
|
||||
|
||||
def __init__(self, config: OpenSPGConfig):
|
||||
"""Initialize the OpenSPG with config details."""
|
||||
pass
|
||||
|
||||
def load_document(self, chunks: List[Chunk]) -> List[str]:
|
||||
"""Load document."""
|
||||
return []
|
||||
|
||||
def similar_search_with_scores(
|
||||
self,
|
||||
text,
|
||||
topk,
|
||||
score_threshold: float,
|
||||
filters: Optional[MetadataFilters] = None,
|
||||
) -> List[Chunk]:
|
||||
"""Similar with scores."""
|
||||
return []
|
||||
|
||||
def query_graph(self, limit: Optional[int] = None) -> Graph:
|
||||
"""Query graph."""
|
||||
return MemoryGraph()
|
||||
|
||||
def delete_vector_name(self, index_name: str):
|
||||
"""Delete vector name."""
|
||||
pass
|
Reference in New Issue
Block a user