From d0052456d45ca6ae6d87a55a6b730c491e9f65ab Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 29 Jan 2025 21:09:11 +0800 Subject: [PATCH] Fix cosine threshold parameter setting error --- lightrag/kg/nano_vector_db_impl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lightrag/kg/nano_vector_db_impl.py b/lightrag/kg/nano_vector_db_impl.py index aa23e811..328a1242 100644 --- a/lightrag/kg/nano_vector_db_impl.py +++ b/lightrag/kg/nano_vector_db_impl.py @@ -83,8 +83,11 @@ class NanoVectorDBStorage(BaseVectorStorage): self._client = NanoVectorDB( self.embedding_func.embedding_dim, storage_file=self._client_file_name ) - self.cosine_better_than_threshold = self.global_config.get( - "cosine_better_than_threshold", self.cosine_better_than_threshold + # get cosine_better_than_threshold from LightRAG + vector_db_kwargs = self.global_config.get("vector_db_storage_cls_kwargs", {}) + self.cosine_better_than_threshold = vector_db_kwargs.get( + "cosine_better_than_threshold", + self.global_config.get("cosine_better_than_threshold", self.cosine_better_than_threshold) ) async def upsert(self, data: dict[str, dict]):