Repository navigation
feat(rag): relevance floor (min_score) for advanced_search (#10703) - #10704
Merged
Merged
Conversation
advanced_search applied no minimum relevance, so non-chat callers ingested whatever top-k returned regardless of score. Add a configurable floor: - advanced_search(..., min_score: float = 0.0): drops results scoring below min_score (rerank_score if present, else hybrid_score) via the extracted _apply_relevance_floor() helper. min_score in the cache key so floored and unfloored results don't collide. - Default 0.0 = no-op → existing callers unaffected; callers/config opt in. Tests: floor drops sub-threshold (rerank_score preferred over hybrid), 0.0 is a no-op (same list), cache key includes min_score (3 new; 7 existing pass). Closes #10703. Part of #10600 / umbrella #10603.
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
Subtask 4.3 of #10600 (umbrella #10603).
advanced_rag_optimizer.advanced_searchapplied no minimum relevance, so non-chat callers (cag_service,graph_rag_service,knowledge/service) ingest whatever top-k returns regardless of score → low-relevance chunks distract/hallucinate. Add a configurable floor — done safe (default off) since the other #10600 flips (MMR/BM25/RLM/reranker-swap) need an eval harness or touch opaque config.What Changed
advanced_search(..., min_score: float = 0.0)— drops results scoring belowmin_score(rerank_score if present, else hybrid_score) via the extracted_apply_relevance_floor()helper.min_scoreadded to the cache key so floored/unfloored results don't collide.Verification
advanced_rag_optimizer_test.py— floor drops sub-threshold (rerank_score preferred over hybrid_score),0.0is a no-op (returns the same list), cache key includesmin_score(3 new; 7 existing pass).flake8 --max-line-length=120clean;black/isortclean.Out of scope (need eval / opaque config)
MMR enable (§4.1 —
mmr_lambdais an opaque dynamicmodel_configand may be disconnected from the optimizer path), BM25 (§4.2), RLM (§4.5), reranker swap (§4.6).Closes #10703. Part of #10600 / umbrella #10603.
Model Used
Claude Opus 4.8 (1M context)