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.
Description
Summary:
This PR introduces a pluggable Reranker layer to MemOS, wires it into Tree Textual Memory and MOS product configs, and tweaks memory filtering thresholds. It adds two backends out-of-the-box—cosine_local (uses embeddings) and http_bge (OpenAI-style rerank API)—plus an example script and configuration factories.
GitHub
New reranker module & factory:
Adds memos/reranker/ with base.py, cosine_local.py, http_bge.py, noop.py, and factory.py to construct rerankers via config.
Config plumbing
New RerankerConfigFactory (src/memos/configs/reranker.py) to describe backend & options.
TreeTextMemoryConfig gains optional reranker and memory_size fields so tree memories can specify reranker and bucket caps.
APIConfig: adds get_reranker_config() and injects it into both create_user_config() and default cube config; supports env-driven selection (MOS_RERANKER_BACKEND, MOS_RERANKER_URL). Defaults to http_bge else cosine_local.
Product behavior
Slightly raises retrieval acceptance threshold and removes minimum count: threshold 0.50 → 0.52, min_num 3 → 0.
Examples & tests
Adds examples/basic_modules/reranker.py demonstrating both backends; deletes older tree_textual_memory_reranker.py.
Updates tree searcher test (tests/memories/textual/test_tree_searcher.py) accordingly.
Fix: #(issue)
Docs Issue/PR: (docs-issue-or-pr-link)
Reviewer: @fridayL
Checklist: