fix: improve numeric knowledge retrieval ranking - #3621
Open
EDDIWARD wants to merge 5 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
EDDIWARD
marked this pull request as ready for review
August 10, 2026 03:03
WMC001
reviewed
Aug 12, 2026
| if top_k <= 0: | ||
| raise ValueError("top_k must be greater than 0") | ||
| if weight_accurate < 0 or weight_accurate > 1: | ||
| if weight_accurate is not None and ( |
Contributor
There was a problem hiding this comment.
if weight_accurate is not None 能否改成 if weight_accurate,这样更简单易懂,等于0也不会影响判断
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.
Summary
This revision keeps the Bug2 fix intentionally lightweight: when the caller has not configured a hybrid-search weight, digit-containing queries use a higher accurate-search weight. Explicit caller weights are preserved.
The previous numeric phrase boost and extra exact-query processing have been removed.
Root cause
For an identifier-like query such as an alert number or IP address, semantic ranking can place a nearby-but-wrong record above the requested record. In the original flow, searching alert
01999returned记录01699.Change
0.7accurate-search weight for digit-containing queries only whenweight_accurateis omitted; non-numeric queries retain the SDK default of0.3.0.5; use0.7only for digit-containing queries with no explicit weight.weight_accuratewhen the user has not configured it, so the backend/SDK can select the appropriate default.Before
With the same reproduction knowledge base and alert-number query for
01999, the agent reported the unrelated记录01699.After
With the lightweight routing enabled, the first retrieved result and final answer are the requested
记录01999.Validation
106 passed.01999now retrieves记录01999first.00001,01000,01500,01999, and192.168.19.33) improved from the former0.3default to the intended record with the adaptive0.7weight.