mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-07 07:23:29 +08:00
调整KBService 接口函数do_search 并适配pg
This commit is contained in:
parent
24e7351d32
commit
2604341e9e
@ -157,6 +157,7 @@ class KBService(ABC):
|
|||||||
def do_search(self,
|
def do_search(self,
|
||||||
query: str,
|
query: str,
|
||||||
top_k: int,
|
top_k: int,
|
||||||
|
score_threshold: float,
|
||||||
embeddings: Embeddings,
|
embeddings: Embeddings,
|
||||||
) -> List[Document]:
|
) -> List[Document]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class PGKBService(KBService):
|
|||||||
'''))
|
'''))
|
||||||
connect.commit()
|
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
|
# todo: support score threshold
|
||||||
self._load_pg_vector(embeddings=embeddings)
|
self._load_pg_vector(embeddings=embeddings)
|
||||||
return self.pg_vector.similarity_search_with_score(query, top_k)
|
return self.pg_vector.similarity_search_with_score(query, top_k)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user