dify/api/core/rag
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
..
cleaner refactor(api): type bare dict/list annotations in remaining rag folder (#33775) 2026-03-20 03:31:06 +09:00
data_post_processor chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
datasource refactor: use MetadataFilteringCondition BaseModel in RetrievalService.external_retrieve 2026-05-07 10:31:37 +05:30
docstore refactor: port ChildChunk (#30920) 2026-04-26 00:59:22 +00:00
embedding chore(api): adapt Graphon 0.2.2 upgrade (#35377) 2026-04-18 11:16:24 +00:00
entities refactor(api): consolidate duplicate RerankingModelConfig and WeightedScoreConfig definitions (#34747) 2026-04-13 05:53:45 +00:00
extractor refactor(api): tighten core rag typing batch 1 (#35210) 2026-04-21 04:32:43 +00:00
index_processor chore(api): adapt Graphon 0.2.2 upgrade (#35377) 2026-04-18 11:16:24 +00:00
models chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
pipeline chore: use from __future__ import annotations (#30254) 2026-01-06 23:57:20 +09:00
rerank chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
retrieval refactor(api): fix pyright errors in jieba, milvus, couchbase, oracle, and router (#34938) 2026-04-23 22:30:28 +00:00
splitter refactor(api): tighten core rag typing batch 1 (#35210) 2026-04-21 04:32:43 +00:00
summary_index refactor(api): migrate core RAG layer to SQLAlchemy 2.0 select() API (#34965) 2026-04-11 16:32:20 +00:00
__init__.py Feat/dify rag (#2528) 2024-02-22 23:31:57 +08:00