-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f430bd1
commit 6968070
Showing
7 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
dbgpt/storage/graph_store/community/community_metastore.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Community metastore.""" | ||
from abc import ABC, abstractmethod | ||
from typing import List | ||
|
||
from dbgpt.datasource.rdbms.base import RDBMSConnector | ||
from dbgpt.storage.graph_store.community_store import Community | ||
from dbgpt.storage.vector_store.base import VectorStoreBase | ||
from dbgpt.storage.vector_store.pgvector_store import PGVectorStore | ||
|
||
|
||
class CommunityMetastore(ABC): | ||
"""Community metastore class.""" | ||
|
||
@abstractmethod | ||
def get(self, community_id: str) -> Community: | ||
"""Get community.""" | ||
|
||
@abstractmethod | ||
def search(self, query: str) -> List[Community]: | ||
"""search communities relevant to query.""" | ||
|
||
@abstractmethod | ||
def save(self, community: Community): | ||
"""Upsert community.""" | ||
|
||
@abstractmethod | ||
def drop(self, community_id: str): | ||
"""Drop community.""" | ||
|
||
|
||
class BuiltinCommunityMetastore(CommunityMetastore): | ||
rdb: RDBMSConnector | ||
|
||
vb: VectorStoreBase | ||
|
||
|
||
class PGVectorCommunityMetastore(CommunityMetastore): | ||
"""Community metastore with vector storage.""" | ||
|
||
pg: PGVectorStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Connector for vector store.""" | ||
"""Graph store factory.""" | ||
import logging | ||
from typing import Tuple, Type | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Graph store base class.""" | ||
"""Graph definition.""" | ||
import itertools | ||
import json | ||
import logging | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Neo4j vector store.""" | ||
"""Neo4j store.""" | ||
import logging | ||
from typing import List, Optional, Tuple, Generator | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters