Support knowledge metadata filter (#15982)
This commit is contained in:
parent
b65f2eb55f
commit
abeaea4f79
48 changed files with 2502 additions and 574 deletions
|
|
@ -177,7 +177,11 @@ class VikingDBVector(BaseVector):
|
|||
query_vector, limit=kwargs.get("top_k", 4)
|
||||
)
|
||||
score_threshold = float(kwargs.get("score_threshold") or 0.0)
|
||||
return self._get_search_res(results, score_threshold)
|
||||
docs = self._get_search_res(results, score_threshold)
|
||||
document_ids_filter = kwargs.get("document_ids_filter")
|
||||
if document_ids_filter:
|
||||
docs = [doc for doc in docs if doc.metadata.get("document_id") in document_ids_filter]
|
||||
return docs
|
||||
|
||||
def _get_search_res(self, results, score_threshold) -> list[Document]:
|
||||
if len(results) == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue