fix bug 1159

修复使用使用pg存储向量时,向量检索错误 {TypeError}TypeError("'Document' object is not subscriptable")
This commit is contained in:
陈鹏 2023-08-18 14:41:11 +08:00 committed by GitHub
parent adb102f5f0
commit 95d9fb0ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -46,7 +46,7 @@ class PGKBService(KBService):
def do_search(self, query: str, top_k: int, score_threshold: float, embeddings: Embeddings) -> List[Document]:
# todo: support score threshold
self._load_pg_vector(embeddings=embeddings)
return self.pg_vector.similarity_search(query, top_k)
return self.pg_vector.similarity_search_with_score(query, top_k)
def add_doc(self, kb_file: KnowledgeFile):
"""