Repository navigation
Conversation
The text-mode _invoke truncated results with a truthiness check on top_n, which treats top_n=0 as falsy and skips the truncation, so a caller asking for zero results got every result back. The multimodal mode already used an is-not-None check, and the payload builder explicitly documented handling top_n=0, so the two paths disagreed. Switch to an is-not-None check so top_n=0 truncates to an empty list, matching the multimodal path and the comment on the payload builder. Bumps the plugin version to 0.0.74.
lisry-1
force-pushed
the
fix/rerank-topn-zero
branch
from
October 29, 2026 09:29
3c3c929 to
71d8568
Compare
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.
What changed
The text-mode
_invoketruncated rerank results with a truthiness check:top_n=0is falsy, so a caller asking for zero results received every result the gateway returned. The multimodal mode already used anis not Nonecheck, and the payload builder in the same text-mode method explicitly documented handlingtop_n=0, so the two paths disagreed:top_n=0behaviour_invoke(text)if top_n:_invoke_multimodalif top_n is not None:This switches the text mode to
if top_n is not None:, aligning it with the multimodal path and with the intent already expressed in the payload builder's comment.Verification
New test file
tests/test_rerank_topn_zero.py(3 cases). Red/green control on the unmodified source:Rerank-related suite and full plugin suite:
ruff checkandruff format --checkare clean on the new/changed lines.Version
manifest.yamlbumped0.0.73 -> 0.0.74per the repo convention.Note: this is independent of my other open PRs (#4131, #4141), which also bump to
0.0.74from the same base. Happy to rebase and re-bump whichever lands last.