mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-11-02 15:48:55 +00:00
✨ feat(GraphRAG): enhance GraphRAG by graph community summary (#1801)
Co-authored-by: Florian <fanzhidongyzby@163.com> Co-authored-by: KingSkyLi <15566300566@163.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: yvonneyx <zhuyuxin0627@gmail.com>
This commit is contained in:
@@ -99,6 +99,14 @@ class VectorStoreConfig(IndexStoreConfig):
|
||||
"The password of vector store, if not set, will use the default password."
|
||||
),
|
||||
)
|
||||
topk: int = Field(
|
||||
default=5,
|
||||
description="Topk of vector search",
|
||||
)
|
||||
score_threshold: float = Field(
|
||||
default=0.3,
|
||||
description="Recall score of vector search",
|
||||
)
|
||||
|
||||
|
||||
class VectorStoreBase(IndexStoreBase, ABC):
|
||||
@@ -108,6 +116,10 @@ class VectorStoreBase(IndexStoreBase, ABC):
|
||||
"""Initialize vector store."""
|
||||
super().__init__(executor)
|
||||
|
||||
@abstractmethod
|
||||
def get_config(self) -> VectorStoreConfig:
|
||||
"""Get the vector store config."""
|
||||
|
||||
def filter_by_score_threshold(
|
||||
self, chunks: List[Chunk], score_threshold: float
|
||||
) -> List[Chunk]:
|
||||
@@ -126,7 +138,7 @@ class VectorStoreBase(IndexStoreBase, ABC):
|
||||
metadata=chunk.metadata,
|
||||
content=chunk.content,
|
||||
score=chunk.score,
|
||||
chunk_id=str(id),
|
||||
chunk_id=chunk.chunk_id,
|
||||
)
|
||||
for chunk in chunks
|
||||
if chunk.score >= score_threshold
|
||||
|
||||
Reference in New Issue
Block a user