Skip to content

gateway: end-to-end top_k for /recall (RecallRequest → handleRecall → auto-recall, clamp 1..50) - #900

Open
francialisomlimoeiro wants to merge 1 commit into
TencentCloud:feat/serverfrom
francialisomlimoeiro:pr/recall-top-k
Open

gateway: end-to-end top_k for /recall (RecallRequest → handleRecall → auto-recall, clamp 1..50)#900
francialisomlimoeiro wants to merge 1 commit into
TencentCloud:feat/serverfrom
francialisomlimoeiro:pr/recall-top-k

Conversation

@francialisomlimoeiro

Copy link
Copy Markdown

What it does

Adds an optional, additive top_k override to the gateway /recall API:

  • src/gateway/types.ts: RecallRequest.top_k?: number (documented; older gateways ignore it).
  • src/gateway/server.ts: numeric validation + clamp 1..50 at the edge; non-numeric falls back to config default.
  • src/core/tdai-core.ts / src/core/hooks/auto-recall.ts: topK plumbed to searchMemories, clamped again defensively, overrides recall.maxResults.

Tests

Repo vitest suite: 2 files, 15 passed. Happy to add a dedicated top_k unit test if maintainers want one.

@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thanks for your contribution and attention! We will review this PR 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.

2 participants