Skip to content

Commit 71a2440

Browse files
authored
fix: Add toggle for fulltext retrieval path (#1096) (#1098)
feat: Add toggle for fulltext retrieval path (FULLTEXT_CALL), default off ## Description Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change. Related Issue (Required): Fixes @issue_number ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Refactor (does not change functionality, e.g. code style improvements, linting) - [ ] Documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Unit Test - [ ] Test Script Or Test Steps (please provide) - [ ] Pipeline Automated API Test (please provide) ## Checklist - [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码 - [ ] I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释 - [ ] I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常 - [ ] I have created related documentation issue/PR in [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) | 我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档 issue/PR(如果适用) - [ ] I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用) - [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人 ## Reviewer Checklist - [ ] closes #xxxx (Replace xxxx with the GitHub issue number) - [ ] Made sure Checks passed - [ ] Tests have been provided
2 parents 8ecf26a + 5b93761 commit 71a2440

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/memos/api/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ def create_user_config(user_name: str, user_id: str) -> tuple["MOSConfig", "Gene
10141014
"fast_graph": bool(os.getenv("FAST_GRAPH", "false") == "true"),
10151015
"bm25": bool(os.getenv("BM25_CALL", "false") == "true"),
10161016
"cot": bool(os.getenv("VEC_COT_CALL", "false") == "true"),
1017+
"fulltext": bool(os.getenv("FULLTEXT_CALL", "false") == "true"),
10171018
},
10181019
"include_embedding": bool(
10191020
os.getenv("INCLUDE_EMBEDDING", "false") == "true"
@@ -1096,6 +1097,7 @@ def get_default_cube_config() -> "GeneralMemCubeConfig | None":
10961097
"fast_graph": bool(os.getenv("FAST_GRAPH", "false") == "true"),
10971098
"bm25": bool(os.getenv("BM25_CALL", "false") == "true"),
10981099
"cot": bool(os.getenv("VEC_COT_CALL", "false") == "true"),
1100+
"fulltext": bool(os.getenv("FULLTEXT_CALL", "false") == "true"),
10991101
},
11001102
"mode": os.getenv("ASYNC_MODE", "sync"),
11011103
"include_embedding": bool(

src/memos/memories/textual/tree_text_memory/retrieve/searcher.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(
6767
self.internet_retriever = internet_retriever
6868
self.vec_cot = search_strategy.get("cot", False) if search_strategy else False
6969
self.use_fast_graph = search_strategy.get("fast_graph", False) if search_strategy else False
70+
self.use_fulltext = search_strategy.get("fulltext", False) if search_strategy else False
7071
self.manual_close_internet = manual_close_internet
7172
self.tokenizer = tokenizer
7273
self._usage_executor = ContextThreadPoolExecutor(max_workers=4, thread_name_prefix="usage")
@@ -380,20 +381,21 @@ def _retrieve_paths(
380381
user_name,
381382
)
382383
)
383-
tasks.append(
384-
executor.submit(
385-
self._retrieve_from_keyword,
386-
query,
387-
parsed_goal,
388-
query_embedding,
389-
top_k,
390-
memory_type,
391-
search_filter,
392-
search_priority,
393-
user_name,
394-
id_filter,
384+
if self.use_fulltext:
385+
tasks.append(
386+
executor.submit(
387+
self._retrieve_from_keyword,
388+
query,
389+
parsed_goal,
390+
query_embedding,
391+
top_k,
392+
memory_type,
393+
search_filter,
394+
search_priority,
395+
user_name,
396+
id_filter,
397+
)
395398
)
396-
)
397399
if search_tool_memory:
398400
tasks.append(
399401
executor.submit(

0 commit comments

Comments
 (0)