Skip to content

✨ new implement : support Rerank models in model management and agent configurations#2700

Open
wadecrack wants to merge 21 commits intodevelopfrom
xq/develop_import_reranker_model
Open

✨ new implement : support Rerank models in model management and agent configurations#2700
wadecrack wants to merge 21 commits intodevelopfrom
xq/develop_import_reranker_model

Conversation

@wadecrack
Copy link
Copy Markdown
Contributor

Added Rerank model support to the Model Management page (supports batch adding).

image-20260316184343008
image-20260316184437699

New Rerank toggle available for search tools (datamate, knowledge_base, dify) in Agent Space.
image-20260316184822105

Enabling Rerank allows for secondary processing of retrieved chunks, leading to higher-quality AI answers in knowledge-based scenarios.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

@wadecrack wadecrack requested a review from Zhi-a March 19, 2026 09:41
kb_search_results.extend(kb_search)

# Apply reranking if enabled
if self.rerank and self.rerank_model and kb_search_results:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

知识库检索支持topk参数,即返回最接近结果的前k个检索结果。

之前检索是 每个知识库都返回k个知识库结果。返回的是k*n(n是知识库数量)
现在有了reranker之后,可以将所有检索结果综合排序,返回k个结果

Image

@@ -93,6 +104,9 @@ def __init__(
self.top_k = top_k
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于 没有开启 rerank的检索工具,topk就返回k个检索结果。
开启了reranker,那么检索结果 应是 k* 系数个检索结果,然后从总的检索结果,综合排序 选择最优。
这个系数 我去确认下。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以先按照10倍,即开启rerank,先检索 10*topK个检索结果

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

系数设定为10,可在nexent/sdk/nexent/core/utils/constants.py 中通过修改RERANK_OVERSEARCH_MULTIPLIER更改

default="",
),
observer: MessageObserver = Field(
description="Message observer", default=None, exclude=True),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于每个工具来说,还提供了工具测试功能。所以,还需要保证加了rerank功能后,测试工具功能也可以正常运行

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3个使用到重排模型的工具,重排功能开启,工具测试均通过
微信图片_20260326163235_114_44
微信图片_20260326164104_115_44
a02fe5174c16e7680b4dd0c35936fda5

@wadecrack wadecrack force-pushed the xq/develop_import_reranker_model branch from 1c39c1e to 1ce40ff Compare March 26, 2026 08:53
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6 Security Hotspots
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@wadecrack wadecrack force-pushed the xq/develop_import_reranker_model branch from abb7061 to ce77cc3 Compare March 27, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants