dify/api/core/rag/datasource
gaurav0107 02fa84d853 refactor: use MetadataFilteringCondition BaseModel in RetrievalService.external_retrieve
Follow the dict -> Pydantic BaseModel pattern established by #31514, #34080
and #34422: RetrievalService.external_retrieve now accepts
metadata_filtering_conditions: MetadataFilteringCondition | None directly
instead of dict[str, Any] | None.

The redundant internal MetadataFilteringCondition.model_validate(...) call
is removed; validation now happens at the call site in
HitTestingService.external_retrieve, following the "validate at the
boundary" principle cited in the issue.

Unit tests are updated to pass typed instances where appropriate and a
regression test is added for the None path. Behavior is otherwise
preserved. external_retrieval_model is left as dict[str, Any] because it
is an opaque payload forwarded to external retrieval providers.

Fixes part of #31497.
2026-05-07 10:31:37 +05:30
..
keyword refactor(api): fix pyright errors in jieba, milvus, couchbase, oracle, and router (#34938) 2026-04-23 22:30:28 +00:00
vdb fix: skip empty documents before vector embedding (#35763) 2026-05-04 13:06:58 +00:00
__init__.py Feat/dify rag (#2528) 2024-02-22 23:31:57 +08:00
retrieval_service.py refactor: use MetadataFilteringCondition BaseModel in RetrievalService.external_retrieve 2026-05-07 10:31:37 +05:30