调整KBService 接口函数do_search 并适配pg

This commit is contained in:
zqt 2023-08-24 22:35:30 +08:00
parent 24e7351d32
commit 2604341e9e
2 changed files with 2 additions and 1 deletions

View File

@ -157,6 +157,7 @@ class KBService(ABC):
def do_search(self,
query: str,
top_k: int,
score_threshold: float,
embeddings: Embeddings,
) -> List[Document]:
"""

View File

@ -43,7 +43,7 @@ class PGKBService(KBService):
'''))
connect.commit()
def do_search(self, query: str, top_k: int, embeddings: Embeddings):
def do_search(self, query: str, top_k: int, score_threshold: float, embeddings: Embeddings):
# todo: support score threshold
self._load_pg_vector(embeddings=embeddings)
return self.pg_vector.similarity_search_with_score(query, top_k)