Repository navigation
Conversation
This branch has not been deployed
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.
Scope
Related issues and approval
No existing issue found for this behavior. This is a small, self-contained fix under the direct-PR path in CONTRIBUTING.md.
Problem and resulting behavior
With query decomposition and
rag.mmr.diversity: 0, MMR re-sorts round-robin retrieval results by their original per-query scores. Those scores are not comparable: a later sub-query hit can replace the first result even though zero diversity promises plain top-k.Return the incoming leading hits unchanged at zero diversity. Positive-diversity scoring and selection remain unchanged.
Approach and review guidance
Add the zero-diversity fast path and regressions for non-monotonic scores, the DuckDB retrieval endpoint with decomposition, full-pool behavior, and positive-diversity relevance/novelty controls.
AI assistance was used to investigate, implement, and validate this change. The endpoint tests use synthetic vectors and deterministic model responses; database queries and retrieval/ranking code run normally. No real model-quality improvement is claimed.
Verification
python -m pytest tests/test_rag_quality.py tests/test_documents.py tests/test_hybrid.py -q: 100 passed on the patch.python -m ruff check serviette tests: passed with Ruff 0.16.10, within the project's dev pin.git diff --check: passed.A broader baseline test selection had 112 passes and 3 import failures because LiteLLM is not installed. Full package, engine-backed indexing, external-model, Docker/backend integration, and multi-version tests were not run.
Checklist
No configuration or API change; the existing zero-diversity contract is restored. No documentation update is needed for the behavior already documented in MmrConfig.