fix: search API silently ignores all memory_types except the first (#78)#138
Open
Exploreunive wants to merge 5 commits intoEverMind-AI:mainfrom
Open
Conversation
…ing the first one Previously, the search API silently ignored all memory_types except the first one. Now all specified memory_types are searched and results are merged. This fixes the issue where passing memory_types=episodic_memory,foresight would only search episodic_memory and silently ignore foresight. Fixes EverMind-AI#78
…sponse and retrieve_mem_agentic The local variable 'memory_type_label' is defined but was incorrectly referenced as 'memory_type' in 8 places across two methods: - _to_response: lines 817, 820 (Metadata construction) - retrieve_mem_agentic: lines 910, 920, 944, 991, 997, 1009 (record_retrieve_request calls and _rerank positional args) Using undefined 'memory_type' would cause NameError at runtime when these code paths are executed.
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.
Note on Duplicate PRs
I see PR #89 and #109 also address issue #78. My fix focuses on the minimal change to support multiple memory_types, with:
Problem
The search API accepts a list of
memory_types, but the retrieval logic only usesmemory_types[0]. All other types are silently ignored — no error, no warning, just missing results.Example: Sending
memory_types=episodic_memory,foresightonly searchesepisodic_memory. Theforesightresults are never returned.Fixes #78
Description
Fix the search API to support multiple
memory_typesinstead of silently ignoring all types except the first one.Type of Change
Related Issues
Fixes #78
Changes Made
get_keyword_search_results— loops over allmemory_types, searches each ES repo independently, merges resultsget_vector_search_results— loops over allmemory_types, searches each Milvus repo independently, merges results_search_hybrid/_search_rrf— benefit automatically since they call the base methodsretrieve_mem_*methods — logging/metrics now use comma-joinedmemory_typevalues (e.g.,episodic_memory,foresight)Design Decisions
memory_typein stage metrics now reflects all searched typesTesting
Test Configuration:
Test Results: