feat: Add correlation threshold filtering and maximum limit for retrieved memories#1006
Merged
CaralHsi merged 51 commits intoMemTensor:dev-20260202-v2.0.5from Feb 6, 2026
Merged
feat: Add correlation threshold filtering and maximum limit for retrieved memories#1006CaralHsi merged 51 commits intoMemTensor:dev-20260202-v2.0.5from
CaralHsi merged 51 commits intoMemTensor:dev-20260202-v2.0.5from
Conversation
# Conflicts: # src/memos/api/handlers/search_handler.py
anatolykoptev
added a commit
to anatolykoptev/MemOSina
that referenced
this pull request
Feb 8, 2026
…xt similarity helpers Adds: - `relativity` field on APISearchRequest (default 0 for PolarDB compat — PolarDB scores are (cosine+1)/2 ≈ 0.5, upstream default 0.57 would filter everything) - `_apply_relativity_threshold()` — post-search quality filter - `include_embedding` parameter pushed down to tree.py search() (cleaner than creating new searcher in handler) - `_dice_similarity()`, `_bigram_similarity()`, `_tfidf_similarity()` static methods for text dedup - Fix: pref_buckets key "preference" → "pref_mem" - Similarity threshold 0.9 → 0.92 Cherry-picked from 2550b93 (MemTensor#1006) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
anatolykoptev
added a commit
to anatolykoptev/MemOSina
that referenced
this pull request
Feb 8, 2026
- Remove duplicate _dice/_bigram/_tfidf_similarity methods from search_handler.py (97 lines, artifact of MemTensor#1006 cherry-pick) - Remove unused escape_sql_string() from polardb/helpers.py - Remove unused seach_by_keywords_* typo aliases from polardb/search.py - Clean up drop_database() unreachable code in polardb/maintenance.py - Remove commented-out sleep blocks in polardb/connection.py - Make heavy ML imports optional in evaluation scripts (tiktoken, sentence_transformers, bert_score) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Description
Correlation Threshold Filtering:
Add a configurable correlation threshold parameter (float, default: 0.0)
If threshold > 0: filter out memories with correlation scores below the threshold
If threshold = 0: return all memories without filtering (backward compatible)
Maximum Retrieval Limit:
Add a configurable maximum number of memories to return (int, default: unlimited/very high)
When retrieving memories, return at most this number of highest-scoring memories
Related Issue (Required): #1005
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist
Reviewer Checklist