fix(falkordb): episode_mentions_reranker inverted ordering and min_score bypass#1687
Open
Naseem77 wants to merge 4 commits into
Open
fix(falkordb): episode_mentions_reranker inverted ordering and min_score bypass#1687Naseem77 wants to merge 4 commits into
Naseem77 wants to merge 4 commits into
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
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 it fixes
Two related bugs in
FalkorSearchOperations.episode_mentions_reranker(graphiti_core/driver/falkordb/operations/search_ops.py):1. Ranking is inverted
Scores are episode-mention counts (higher = more relevant), but the sort was ascending, so the least-mentioned nodes ranked first. A node mentioned by 3 episodes ranked below a node mentioned by 1.
2. Unmentioned nodes bypass
min_scoreNodes with no
MENTIONSedges were givenfloat('inf')as a score, which passes anymin_scorethreshold (and, combined with the ascending sort, also pushed them to the end rather than filtering them). They now score0, so any positivemin_scorefilters them out.Related: #1342 reported the inverted ordering for the legacy
search_utils.pypath (fix pending in #1640/#1512), but this ops-layer copy has the same bugs and is not covered by those PRs.Before / after
With
Popularmentioned by 3 episodes,Rareby 1,Unmentionedby 0:Validation
min_score; verified it fails on the unfixed code and passes with the fixtests/driversuite passes against a live FalkorDB