Skip to content

feat(recall): add optional remote rerank#371

Open
RerankerGuo wants to merge 1 commit into
TencentCloud:mainfrom
RerankerGuo:feat/remote-rerank-3
Open

feat(recall): add optional remote rerank#371
RerankerGuo wants to merge 1 commit into
TencentCloud:mainfrom
RerankerGuo:feat/remote-rerank-3

Conversation

@RerankerGuo

Copy link
Copy Markdown
Contributor

Description | 描述

Add a narrow, default-off remote rerank step for auto-recalled L1 memories.

The recall pipeline still runs the existing keyword / embedding / hybrid search first. When recall.rerank.enabled is configured with a baseUrl, apiKey, and model, the plugin calls ${baseUrl}/rerank with the initial recalled candidates and reorders them by the returned index / relevance_score values before applying recall character budgets.

This keeps the feature conservative:

  • Existing deployments are unchanged because rerank is disabled by default.
  • Search still works when rerank is unavailable.
  • HTTP errors, malformed responses, incomplete config, and timeout failures keep the original recall order.
  • The request has a short independent timeout (recall.rerank.timeoutMs, default 1000ms) so rerank cannot block the broader recall path for long.

Related Issue | 关联 Issue

Fix #3

Change Type | 修改类型

  • Bug fix | Bug 修复
  • New feature | 新功能
  • Documentation update | 文档更新
  • Code optimization | 代码优化

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Verification | 验证

  • npx vitest run src/core/recall/rerank.test.ts
  • npm test
  • npm run build
  • git diff --check

Additional Notes | 其他说明

The implementation intentionally targets auto-recall only as a first step, because that is where irrelevant top-K memories directly enter prompt context. Agent-initiated tdai_memory_search can remain deterministic and inspectable unless maintainers want rerank applied there as a follow-up.

Signed-off-by: Ziyang Guo <121015044+RerankerGuo@users.noreply.github.com>
@RerankerGuo RerankerGuo force-pushed the feat/remote-rerank-3 branch from 8167fcb to 8aa1f23 Compare July 2, 2026 10:34
@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thanks for your attention! We’ll review this and get back to you as soon as possible.

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.

[Feature] 提问关于 rerank 功能

2 participants