mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-03 01:12:15 +00:00
Co-authored-by: KingSkyLi <15566300566@163.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
"""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
|