Feat: Add metadata filtering function for /api/v1/retrieval (#9877)

-Added the metadata_dedition parameter in the document retrieval
interface to filter document metadata -Updated the API documentation and
added explanations for the metadata_dedition parameter

### What problem does this PR solve?

Make /api/v1/retrieval api also can use metadata filter

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
天海蒼灆
2025-09-05 11:12:15 +08:00
committed by GitHub
parent 8e30a75e5c
commit 677c99b090
4 changed files with 22 additions and 12 deletions

View File

@ -197,7 +197,8 @@ class RAGFlow:
top_k=1024,
rerank_id: str | None = None,
keyword: bool = False,
cross_languages: list[str]|None = None
cross_languages: list[str]|None = None,
metadata_condition: dict | None = None,
):
if document_ids is None:
document_ids = []
@ -212,7 +213,8 @@ class RAGFlow:
"question": question,
"dataset_ids": dataset_ids,
"document_ids": document_ids,
"cross_languages": cross_languages
"cross_languages": cross_languages,
"metadata_condition": metadata_condition
}
# Send a POST request to the backend service (using requests library as an example, actual implementation may vary)
res = self.post("/retrieval", json=data_json)