MemoryOS 0.2.2__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of MemoryOS might be problematic. Click here for more details.
- {memoryos-0.2.2.dist-info → memoryos-1.0.0.dist-info}/METADATA +6 -1
- {memoryos-0.2.2.dist-info → memoryos-1.0.0.dist-info}/RECORD +61 -55
- memos/__init__.py +1 -1
- memos/api/config.py +6 -8
- memos/api/context/context.py +1 -1
- memos/api/context/dependencies.py +11 -0
- memos/configs/internet_retriever.py +13 -0
- memos/configs/mem_scheduler.py +38 -16
- memos/graph_dbs/base.py +30 -3
- memos/graph_dbs/nebular.py +442 -194
- memos/graph_dbs/neo4j.py +14 -5
- memos/log.py +5 -0
- memos/mem_os/core.py +19 -9
- memos/mem_os/main.py +1 -1
- memos/mem_os/product.py +6 -69
- memos/mem_os/utils/default_config.py +1 -1
- memos/mem_os/utils/format_utils.py +11 -47
- memos/mem_os/utils/reference_utils.py +133 -0
- memos/mem_scheduler/base_scheduler.py +58 -55
- memos/mem_scheduler/{modules → general_modules}/base.py +1 -2
- memos/mem_scheduler/{modules → general_modules}/dispatcher.py +54 -15
- memos/mem_scheduler/{modules → general_modules}/rabbitmq_service.py +4 -4
- memos/mem_scheduler/{modules → general_modules}/redis_service.py +1 -1
- memos/mem_scheduler/{modules → general_modules}/retriever.py +19 -5
- memos/mem_scheduler/{modules → general_modules}/scheduler_logger.py +10 -4
- memos/mem_scheduler/general_scheduler.py +110 -67
- memos/mem_scheduler/monitors/__init__.py +0 -0
- memos/mem_scheduler/monitors/dispatcher_monitor.py +305 -0
- memos/mem_scheduler/{modules/monitor.py → monitors/general_monitor.py} +57 -19
- memos/mem_scheduler/mos_for_test_scheduler.py +7 -1
- memos/mem_scheduler/schemas/general_schemas.py +3 -2
- memos/mem_scheduler/schemas/message_schemas.py +2 -1
- memos/mem_scheduler/schemas/monitor_schemas.py +10 -2
- memos/mem_scheduler/utils/misc_utils.py +43 -2
- memos/memories/activation/item.py +1 -1
- memos/memories/activation/kv.py +20 -8
- memos/memories/textual/base.py +1 -1
- memos/memories/textual/general.py +1 -1
- memos/memories/textual/tree_text_memory/organize/{conflict.py → handler.py} +30 -48
- memos/memories/textual/tree_text_memory/organize/manager.py +8 -96
- memos/memories/textual/tree_text_memory/organize/relation_reason_detector.py +2 -0
- memos/memories/textual/tree_text_memory/organize/reorganizer.py +102 -140
- memos/memories/textual/tree_text_memory/retrieve/bochasearch.py +229 -0
- memos/memories/textual/tree_text_memory/retrieve/internet_retriever_factory.py +9 -0
- memos/memories/textual/tree_text_memory/retrieve/recall.py +15 -8
- memos/memories/textual/tree_text_memory/retrieve/reranker.py +1 -1
- memos/memories/textual/tree_text_memory/retrieve/searcher.py +177 -125
- memos/memories/textual/tree_text_memory/retrieve/task_goal_parser.py +7 -2
- memos/memories/textual/tree_text_memory/retrieve/utils.py +1 -1
- memos/memos_tools/lockfree_dict.py +120 -0
- memos/memos_tools/thread_safe_dict.py +288 -0
- memos/templates/mem_reader_prompts.py +2 -0
- memos/templates/mem_scheduler_prompts.py +23 -10
- memos/templates/mos_prompts.py +40 -11
- memos/templates/tree_reorganize_prompts.py +24 -17
- memos/utils.py +19 -0
- memos/memories/textual/tree_text_memory/organize/redundancy.py +0 -193
- {memoryos-0.2.2.dist-info → memoryos-1.0.0.dist-info}/LICENSE +0 -0
- {memoryos-0.2.2.dist-info → memoryos-1.0.0.dist-info}/WHEEL +0 -0
- {memoryos-0.2.2.dist-info → memoryos-1.0.0.dist-info}/entry_points.txt +0 -0
- /memos/mem_scheduler/{modules → general_modules}/__init__.py +0 -0
- /memos/mem_scheduler/{modules → general_modules}/misc.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: MemoryOS
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Intelligence Begins with Memory
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: memory,llm,language model,memoryOS,agent,kv cache,lora
|
|
@@ -310,6 +310,11 @@ MemOS is licensed under the [Apache 2.0 License](./LICENSE).
|
|
|
310
310
|
|
|
311
311
|
Stay up to date with the latest MemOS announcements, releases, and community highlights.
|
|
312
312
|
|
|
313
|
+
|
|
314
|
+
- **2025-08-07** - 🎉 *MemOS v1.0.0 (MemCube Release)*: First MemCube with word game demo, LongMemEval evaluation, BochaAISearchRetriever integration, NebulaGraph support, enhanced search capabilities, and official Playground launch.
|
|
315
|
+
- **2025-07-29** – 🎉 *MemOS v0.2.2 (Nebula Update)*: Internet search+Nebula DB integration, refactored memory scheduler, KV Cache stress tests, MemCube Cookbook release (CN/EN), and 4b/1.7b/0.6b memory ops models.
|
|
316
|
+
- **2025-07-21** – 🎉 *MemOS v0.2.1 (Neo Release)*: Lightweight Neo version with plaintext+KV Cache functionality, Docker/multi-tenant support, MCP expansion, and new Cookbook/Mud game examples.
|
|
317
|
+
- **2025-07-11** – 🎉 *MemOS v0.2.0 (Cross-Platform)*: Added doc search/bilingual UI, MemReader-4B (local deploy), full Win/Mac/Linux support, and playground end-to-end connection.
|
|
313
318
|
- **2025-07-07** – 🎉 *MemOS 1.0 (Stellar) Preview Release*: A SOTA Memory OS for LLMs is now open-sourced.
|
|
314
319
|
- **2025-07-04** – 🎉 *MemOS Paper Released*: [MemOS: A Memory OS for AI System](https://arxiv.org/abs/2507.03724) was published on arXiv.
|
|
315
320
|
- **2025-05-28** – 🎉 *Short Paper Uploaded*: [MemOS: An Operating System for Memory-Augmented Generation (MAG) in Large Language Models](https://arxiv.org/abs/2505.22101) was published on arXiv.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
memos/__init__.py,sha256=
|
|
2
|
-
memos/api/config.py,sha256=
|
|
3
|
-
memos/api/context/context.py,sha256=
|
|
4
|
-
memos/api/context/dependencies.py,sha256=
|
|
1
|
+
memos/__init__.py,sha256=QI66SSrW4g7NoA88QjatThCfb04l9wOgmSamPL1zl1U,575
|
|
2
|
+
memos/api/config.py,sha256=mK-OpSIsS2OBs4HuUTZ8R_oQuFTMQxb_NMrOGjgfJ6g,23605
|
|
3
|
+
memos/api/context/context.py,sha256=HBMeg3-e-rOJXMU7aR0JCsEIECuefEx8eyFT-1sSG9c,4158
|
|
4
|
+
memos/api/context/dependencies.py,sha256=8aa-xciqlG-THJnJ9YqhP5BtVIDIBGYpLQOuXK_DgQA,2652
|
|
5
5
|
memos/api/exceptions.py,sha256=MfTNXwLwJE7tHwNVTHlJsB3kF14oA0JfA1-S8xrZEus,833
|
|
6
6
|
memos/api/mcp_serve.py,sha256=GtJDZYx4yxKMs4sCddKJbRAjgsbRunr6S2nAT-KeBMs,21270
|
|
7
7
|
memos/api/product_api.py,sha256=pDsxxrw6sF03hmh6dGqahJjlWWKvg_GGs2-TZMy3e8I,954
|
|
@@ -19,13 +19,13 @@ memos/configs/base.py,sha256=bOOhEU6HGFTq5jne_TXn8Br72rvAfJHYvYllFUPs12A,2588
|
|
|
19
19
|
memos/configs/chunker.py,sha256=Ulci0MyhS_FkuV95l7Pr9Vei179aEFEUigwVmtmSDfI,1593
|
|
20
20
|
memos/configs/embedder.py,sha256=e_aOkUamW2NYSBEzsKkw0jNqHERy5GU3A2cSH5G5y68,2750
|
|
21
21
|
memos/configs/graph_db.py,sha256=800e8PqiXTaOBX-GQHRP9f3Gx-0Ma7fnO0pdA5WHJ0k,5868
|
|
22
|
-
memos/configs/internet_retriever.py,sha256=
|
|
22
|
+
memos/configs/internet_retriever.py,sha256=yWU6avRU9Hqox8hmR0EyILUr4x9wDvcKkhwRwT3PROc,3749
|
|
23
23
|
memos/configs/llm.py,sha256=cso9ZBOdPzOAcgypp2nPFHdynswdG9MZZ-qdgOTEXL8,4175
|
|
24
24
|
memos/configs/mem_chat.py,sha256=TjEQHRG1HpLwCBo3hrn5aVK23rykNtV6Be5p4YIg7F4,2571
|
|
25
25
|
memos/configs/mem_cube.py,sha256=k95dvNxusnyS9w6ciWgNkUXwbHa4HTUEUS-PfPbR0BM,3105
|
|
26
26
|
memos/configs/mem_os.py,sha256=FGrBaFWGUdCKkb4MFDRz9hCE7hydLd0XEFgUrqEhQJw,2755
|
|
27
27
|
memos/configs/mem_reader.py,sha256=hTLFdmPhPIY70Fh_s4ptTGJ3LN-B9n111QG1kboxoNk,2307
|
|
28
|
-
memos/configs/mem_scheduler.py,sha256=
|
|
28
|
+
memos/configs/mem_scheduler.py,sha256=kLE1JZM2IkzpsEdvJ0D0w3MNbjsqfB_--EvdZomHB5s,7644
|
|
29
29
|
memos/configs/mem_user.py,sha256=U0UzCvTacUOxeajJMfXAWWy3a0l52B4LUhH_L7U1VQ4,2036
|
|
30
30
|
memos/configs/memory.py,sha256=ksLE6JoRhe0Sc_H-efbFFbjv7kzm9lQ9WMqqrn6WsS8,7171
|
|
31
31
|
memos/configs/parser.py,sha256=dy-QoevJbCnkJePKgpzR4oziOzYnS4jB6XH-YrpeMns,1145
|
|
@@ -42,11 +42,11 @@ memos/embedders/sentence_transformer.py,sha256=QJoW7qMbvAzmMUXzIhMHXVFnDFurfzxdo
|
|
|
42
42
|
memos/embedders/universal_api.py,sha256=BpmLL18y2neEAIE4CdC-1qr0uOEOJ6o7V_zycdkJmZk,1270
|
|
43
43
|
memos/exceptions.py,sha256=UnBoZUYdwb1KoQPE-pXSLT4yOjkwxse9fx0rb_MhEzo,531
|
|
44
44
|
memos/graph_dbs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
memos/graph_dbs/base.py,sha256
|
|
45
|
+
memos/graph_dbs/base.py,sha256=hW3-2Gg_n178jrb7-T1BSHd42-3_fT5e9lYqqlnImFQ,8259
|
|
46
46
|
memos/graph_dbs/factory.py,sha256=N1NaABiNnYvnsB-L82LrQaLvND5seCabFdSDsD8LoyA,932
|
|
47
47
|
memos/graph_dbs/item.py,sha256=BfK17hA_hHu7I348jWugP_rb9GS5hpKfgqtYGGHBohk,1450
|
|
48
|
-
memos/graph_dbs/nebular.py,sha256=
|
|
49
|
-
memos/graph_dbs/neo4j.py,sha256=
|
|
48
|
+
memos/graph_dbs/nebular.py,sha256=TObODgjQvNLzoRDc4UcKcfceIujtOnwZlOfVb4GhcOM,58097
|
|
49
|
+
memos/graph_dbs/neo4j.py,sha256=grPBo91cZln2A9e13WkZk9rPuZSX5VLxERSgXT5p6wM,42605
|
|
50
50
|
memos/graph_dbs/neo4j_community.py,sha256=6_1_m3gPl4TxGWdLRCu91vHH5G7E6iBteDQ952hQ844,11382
|
|
51
51
|
memos/hello_world.py,sha256=RV1vXfK1_U_xAvSusqc-4A8wk3yr8WEQ9q88dmBxvnI,3057
|
|
52
52
|
memos/llms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -60,7 +60,7 @@ memos/llms/openai.py,sha256=yOcdG320q0JFLi7ipHDXoPWpvyeOMFwbzrnXtk2xqec,3832
|
|
|
60
60
|
memos/llms/qwen.py,sha256=RFVoC_hxFe4dhCQ583fbTcT1AC3jDrKH0r6cDsZ0Cmo,2459
|
|
61
61
|
memos/llms/utils.py,sha256=OcbM9iSpFJpio7sTT5wvxVx-JnqjIx7eSgiRk7dt0ZI,292
|
|
62
62
|
memos/llms/vllm.py,sha256=cBJx61j0InhoOacIinj3EJxFOfWh14a7_GMiFUmsPCk,5624
|
|
63
|
-
memos/log.py,sha256=
|
|
63
|
+
memos/log.py,sha256=qf6x4SAHWm7FsxCpwF400ssPnye7eK8I3_05hXjATY0,2311
|
|
64
64
|
memos/mem_chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
65
|
memos/mem_chat/base.py,sha256=LICB_mwUkdCVKb_r33GEPbrEr-2v3dEnI54cAvhcEew,830
|
|
66
66
|
memos/mem_chat/factory.py,sha256=KKCDG9FrpfY2hD3iJ4GM9x8dN09dyhstP1cOUH_knrY,720
|
|
@@ -70,37 +70,40 @@ memos/mem_cube/base.py,sha256=NoZKz16oO5AAnJ0alcY52Z1c3C1rbGRe8Znz0CCzDnw,864
|
|
|
70
70
|
memos/mem_cube/general.py,sha256=w1HbDIM7MD6Pu_Pbv4KHgQlxOMaCHvvJk_tmA9rZ_q8,8370
|
|
71
71
|
memos/mem_cube/utils.py,sha256=gDwiRo9VEvaTaRDzjWOGAH13ALRRV9bvUG7A-wy4KTA,5522
|
|
72
72
|
memos/mem_os/client.py,sha256=0M-WRTlQr7fDAYtq4B8dsMR0PfmyvD-ySMhKcW3Umd0,43
|
|
73
|
-
memos/mem_os/core.py,sha256=
|
|
74
|
-
memos/mem_os/main.py,sha256=
|
|
75
|
-
memos/mem_os/product.py,sha256=
|
|
76
|
-
memos/mem_os/utils/default_config.py,sha256=
|
|
77
|
-
memos/mem_os/utils/format_utils.py,sha256=
|
|
73
|
+
memos/mem_os/core.py,sha256=7EsAeI8FLeKrgtMG1GRIwdpGMJLHcN8g1hErkvkyVhc,44214
|
|
74
|
+
memos/mem_os/main.py,sha256=zjgQy80QN70Xt6GHqn5zw-_2jOT6RWMCh9Yx-3zZuyw,24534
|
|
75
|
+
memos/mem_os/product.py,sha256=3ge9x0miUrqYaApxNZ0KYIuocUZKn3-Zz4t3BEQQguA,50719
|
|
76
|
+
memos/mem_os/utils/default_config.py,sha256=OdDCyrE3-duSK0vMfO4AelGUwMt14ffHKMrvki0YKlI,12273
|
|
77
|
+
memos/mem_os/utils/format_utils.py,sha256=QaxImCM0E27l2tkRLzWM1s8vSp3MO_LNaY0APHgV35o,49883
|
|
78
|
+
memos/mem_os/utils/reference_utils.py,sha256=jlyqZrmCKjyeq5czamHH8J--jsJfgL3Np1nFKfKVhJY,5464
|
|
78
79
|
memos/mem_reader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
79
80
|
memos/mem_reader/base.py,sha256=SSuaD3J88XbHsME1Qa-EAgZ57xApPHPHppMSeeS3JZ4,957
|
|
80
81
|
memos/mem_reader/factory.py,sha256=emKnId9BhScSkqCZyLSLWntixnU3wAMIOVdsRpHldJA,766
|
|
81
82
|
memos/mem_reader/memory.py,sha256=f3fAjrs8Jf6mBZWTgzkEZle7XjDwTJHxM1L2sOb85Tg,13288
|
|
82
83
|
memos/mem_reader/simple_struct.py,sha256=cZ-yaR95n8PkSRQJVPZ4pWZ8V_nECX8miZyDFIQwymk,10209
|
|
83
84
|
memos/mem_scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
|
-
memos/mem_scheduler/base_scheduler.py,sha256=
|
|
85
|
-
memos/mem_scheduler/
|
|
86
|
-
memos/mem_scheduler/
|
|
87
|
-
memos/mem_scheduler/
|
|
88
|
-
memos/mem_scheduler/
|
|
89
|
-
memos/mem_scheduler/
|
|
90
|
-
memos/mem_scheduler/
|
|
91
|
-
memos/mem_scheduler/
|
|
92
|
-
memos/mem_scheduler/
|
|
93
|
-
memos/mem_scheduler/
|
|
94
|
-
memos/mem_scheduler/
|
|
95
|
-
memos/mem_scheduler/
|
|
85
|
+
memos/mem_scheduler/base_scheduler.py,sha256=wxBmdsJUmiufQLEfqflb4EUs9h9JE1EcMdsr_CA-LKE,23255
|
|
86
|
+
memos/mem_scheduler/general_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
|
+
memos/mem_scheduler/general_modules/base.py,sha256=j2FfGl5mx0CflHGnzu2fFFfZT_WRAMzmmTW_HUxFRgw,2946
|
|
88
|
+
memos/mem_scheduler/general_modules/dispatcher.py,sha256=weDMAumIFJORJnpIm_8epz5d5pZ3XFx23O_0k-UONww,7375
|
|
89
|
+
memos/mem_scheduler/general_modules/misc.py,sha256=qtHx_M3O0p01-bdje5xp4YbTYcU6rpoRsDvPikxOU-s,3574
|
|
90
|
+
memos/mem_scheduler/general_modules/rabbitmq_service.py,sha256=kXfL8Q7eo8H2OMUDhAotbYG9cpL89HDJ5h7A64caKrw,12620
|
|
91
|
+
memos/mem_scheduler/general_modules/redis_service.py,sha256=oHa9EvrpkknGAeygjmc8tExyCJVOU_7SZU6ScMOT9pY,5898
|
|
92
|
+
memos/mem_scheduler/general_modules/retriever.py,sha256=6BiT-rxdXNnlDJjikQVwuy279W0tePo7tbb6j8c8j6s,7849
|
|
93
|
+
memos/mem_scheduler/general_modules/scheduler_logger.py,sha256=8nzdjCd6I4-KRPwLjdf8eXcSQ0i_-xK6rAbQ3j1-GrA,9985
|
|
94
|
+
memos/mem_scheduler/general_scheduler.py,sha256=oPGSvXKzFVYDr0YFnjS42zFYydHOXqlWd1woZ83CptA,14743
|
|
95
|
+
memos/mem_scheduler/monitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
|
+
memos/mem_scheduler/monitors/dispatcher_monitor.py,sha256=xy3fFa_vM5PpVHWweMTh3V3bZmnccWV49x0nBNFAVVw,10930
|
|
97
|
+
memos/mem_scheduler/monitors/general_monitor.py,sha256=pv_T-olU0XTO44-rXgfqX43nmDEp8iq-rwlMyAA0Lxk,12962
|
|
98
|
+
memos/mem_scheduler/mos_for_test_scheduler.py,sha256=kioG5V27V8jfXxFA9OHpKoULNF697eGToVo7z-U3mqQ,5950
|
|
96
99
|
memos/mem_scheduler/scheduler_factory.py,sha256=pw6FKO0EuxFRipMnD22DvcjbM6pdmVfJmRjUvdTaU5E,800
|
|
97
100
|
memos/mem_scheduler/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
|
-
memos/mem_scheduler/schemas/general_schemas.py,sha256=
|
|
99
|
-
memos/mem_scheduler/schemas/message_schemas.py,sha256=
|
|
100
|
-
memos/mem_scheduler/schemas/monitor_schemas.py,sha256=
|
|
101
|
+
memos/mem_scheduler/schemas/general_schemas.py,sha256=r9Ew8KHTVxiDTTLKad1jw12uNMyLltFmn2htplSqbhk,1344
|
|
102
|
+
memos/mem_scheduler/schemas/message_schemas.py,sha256=ahTEY6x8gSXszURne1nKgHCkfEXfKOEXaTKTUsQ9IW0,5977
|
|
103
|
+
memos/mem_scheduler/schemas/monitor_schemas.py,sha256=OvFwchhFCvkHnp8k7NYAQQ5Lq7N0cNKA0mSEasNRLkU,12715
|
|
101
104
|
memos/mem_scheduler/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
102
105
|
memos/mem_scheduler/utils/filter_utils.py,sha256=GsEsVjB6zZbF2gITxXN1DWTLoLG-d8A3TFnGzy1uIaQ,6286
|
|
103
|
-
memos/mem_scheduler/utils/misc_utils.py,sha256
|
|
106
|
+
memos/mem_scheduler/utils/misc_utils.py,sha256=zOCpwzCrj0mfiW7BoWiTFEPj-dzdcYZnqMDtKDGO0kc,2765
|
|
104
107
|
memos/mem_user/factory.py,sha256=zdC-208YYU4dpUaMpICzNbhMTiLaJDxLJoq4bl-6YiU,2956
|
|
105
108
|
memos/mem_user/mysql_persistent_user_manager.py,sha256=fSndxW6MR7u9ImWCPq-gsuFb2TYX1BXF6Kkv1FCS6Fw,9257
|
|
106
109
|
memos/mem_user/mysql_user_manager.py,sha256=gpNYr9XZhtr1fVV-y5zsduEOKStqAFUSf5BE0B6WQKM,16285
|
|
@@ -110,8 +113,8 @@ memos/mem_user/user_manager.py,sha256=-Dwo8oR0AbnCGY9s3utm2ZqOvTJCpDTF5hlkvPRNiq
|
|
|
110
113
|
memos/memories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
111
114
|
memos/memories/activation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
112
115
|
memos/memories/activation/base.py,sha256=kiC35AOnuofgYMzLxZyVULsfOoVq03BGvi6AXtNvF-I,1151
|
|
113
|
-
memos/memories/activation/item.py,sha256=
|
|
114
|
-
memos/memories/activation/kv.py,sha256=
|
|
116
|
+
memos/memories/activation/item.py,sha256=8oo3odhNnvg36NYLobwkehAHj74mo36IcH2MrlXSCEI,1720
|
|
117
|
+
memos/memories/activation/kv.py,sha256=c3rhOowxqmYnUnVKGT1XqsHQurl44Ht98wCDz42laP8,8903
|
|
115
118
|
memos/memories/activation/vllmkv.py,sha256=QM6Y8a3dhqGa08_5rbE-JTR4EakNgoEEVfLdVcvmgms,7765
|
|
116
119
|
memos/memories/base.py,sha256=Sr-dEuDc982WwdVREQ2nL8L6rUc0KZPTaBJeYdgx8h8,577
|
|
117
120
|
memos/memories/factory.py,sha256=Z49DRF_VHQJI2UNiTJ_1ouPqg_iCcuV_Tcg5fXkKxlM,1418
|
|
@@ -120,50 +123,53 @@ memos/memories/parametric/base.py,sha256=RQK2LeaMRr2rVbfoa0M7RJx4r0dGD_uBXt73eiz
|
|
|
120
123
|
memos/memories/parametric/item.py,sha256=9FcY7kf53Uvl5FGXn23o2c0dI_9aUcYjUqTxKOMlbuI,219
|
|
121
124
|
memos/memories/parametric/lora.py,sha256=TqSI2OjmFi-XXCeM-MchSwh1sAhOwL7_JnOwSy9qpis,1397
|
|
122
125
|
memos/memories/textual/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
-
memos/memories/textual/base.py,sha256=
|
|
124
|
-
memos/memories/textual/general.py,sha256=
|
|
126
|
+
memos/memories/textual/base.py,sha256=5AQ0oR1rLd7yiwIKPxt2OmAlL6mWhwUl_U8zuafoDfI,2827
|
|
127
|
+
memos/memories/textual/general.py,sha256=exHPHejBE6jZNLm8pT951sIko8hAqNdOaHZdnNdfzBA,8877
|
|
125
128
|
memos/memories/textual/item.py,sha256=xhyjuL6QfZaf33OaWb2v96QWlZ01_WLkWkWKDh5N9LU,5249
|
|
126
129
|
memos/memories/textual/naive.py,sha256=Z_gfbxI6cQGJ_raOTQic4fnpo493Xq3yEQ8qDV4xplo,6954
|
|
127
130
|
memos/memories/textual/tree.py,sha256=8K_x5zv3CV8kmQa6lfhXk4OgcmbRUtSy8hZ7JvbJFmU,13787
|
|
128
131
|
memos/memories/textual/tree_text_memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
129
132
|
memos/memories/textual/tree_text_memory/organize/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
130
|
-
memos/memories/textual/tree_text_memory/organize/
|
|
131
|
-
memos/memories/textual/tree_text_memory/organize/manager.py,sha256=
|
|
132
|
-
memos/memories/textual/tree_text_memory/organize/
|
|
133
|
-
memos/memories/textual/tree_text_memory/organize/
|
|
134
|
-
memos/memories/textual/tree_text_memory/organize/reorganizer.py,sha256=eCFONhtd-o2f_LRXbkDg6gIpJRpDKhG1z_RbRHE2-eg,24031
|
|
133
|
+
memos/memories/textual/tree_text_memory/organize/handler.py,sha256=l7WuwWvubGzgaOSUBS0VNjSQU2JxtjwLMtKHxpms8NQ,8139
|
|
134
|
+
memos/memories/textual/tree_text_memory/organize/manager.py,sha256=r-0O9hS3y3oQrTaKOulLmbsquk_FW6eEPse6tf7AuVM,9783
|
|
135
|
+
memos/memories/textual/tree_text_memory/organize/relation_reason_detector.py,sha256=udqQEFZb6TiarB-Rya1N7fKiWHtXiLkggh8bFKIlDjU,8816
|
|
136
|
+
memos/memories/textual/tree_text_memory/organize/reorganizer.py,sha256=txBC6uo3fId4RaTJeTJEg4V3Q-jrIP0jBHqVQkjjAqc,22719
|
|
135
137
|
memos/memories/textual/tree_text_memory/retrieve/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
|
+
memos/memories/textual/tree_text_memory/retrieve/bochasearch.py,sha256=2TjlAJ5vLoOvBTlqRXul6elBUvvPuB9PsYy1xuqX-Ho,8196
|
|
136
139
|
memos/memories/textual/tree_text_memory/retrieve/internet_retriever.py,sha256=aD2bujlVBWzDa9ZfB9vdB9Hq2erCpc426AVcolItWIM,8656
|
|
137
|
-
memos/memories/textual/tree_text_memory/retrieve/internet_retriever_factory.py,sha256=
|
|
140
|
+
memos/memories/textual/tree_text_memory/retrieve/internet_retriever_factory.py,sha256=3-hJwpGrAAag7z772QBvW9ZBvNI_od5GO1nRv5Q3GbQ,3767
|
|
138
141
|
memos/memories/textual/tree_text_memory/retrieve/reasoner.py,sha256=5csoGjviFbN9RJ8dm3B6kjvoC8xbPD8UMiGusefHaf0,2228
|
|
139
|
-
memos/memories/textual/tree_text_memory/retrieve/recall.py,sha256=
|
|
140
|
-
memos/memories/textual/tree_text_memory/retrieve/reranker.py,sha256=
|
|
142
|
+
memos/memories/textual/tree_text_memory/retrieve/recall.py,sha256=s8bTlTDsgnuqy-nIZ9-Mnp3LalXKaDqDEwn-GLo6ntw,6108
|
|
143
|
+
memos/memories/textual/tree_text_memory/retrieve/reranker.py,sha256=GIo_ZqA8Oea-L58Md724ak7Oq2fCnLfBWBUvMWiD7mY,3727
|
|
141
144
|
memos/memories/textual/tree_text_memory/retrieve/retrieval_mid_structs.py,sha256=CvGfdwtOwC78OWKb1nOg_tsPualirsRfbtA58_kxNpA,433
|
|
142
|
-
memos/memories/textual/tree_text_memory/retrieve/searcher.py,sha256=
|
|
143
|
-
memos/memories/textual/tree_text_memory/retrieve/task_goal_parser.py,sha256=
|
|
144
|
-
memos/memories/textual/tree_text_memory/retrieve/utils.py,sha256=
|
|
145
|
+
memos/memories/textual/tree_text_memory/retrieve/searcher.py,sha256=_ZEmupkjE9_Hu4X4DeQ1d2qKf2mYBdLRtKRROwqGN1U,10734
|
|
146
|
+
memos/memories/textual/tree_text_memory/retrieve/task_goal_parser.py,sha256=vqgyczpS5As9zmljX9YF7TL0fgpl_T22FN5qV_AbcS8,3733
|
|
147
|
+
memos/memories/textual/tree_text_memory/retrieve/utils.py,sha256=HuN4urTkrmlXJV7X3bw8LneyAt-azgqwlf2eCOev-ts,2072
|
|
145
148
|
memos/memories/textual/tree_text_memory/retrieve/xinyusearch.py,sha256=x-nlZJ84shgAq9FqQR3YvE6iTMY_B7Pc0YaiGEqM1rc,10518
|
|
146
149
|
memos/memos_tools/dinding_report_bot.py,sha256=kXmooO_wUpwErT6Obql-SQu8lbt0XnM_58znIeQt734,14735
|
|
150
|
+
memos/memos_tools/lockfree_dict.py,sha256=A2hFUSyjTIauiXONYzr7zFZfGlOF9J9cqrfzDNBaw_w,3811
|
|
147
151
|
memos/memos_tools/notification_service.py,sha256=CZ7tZI6m0A063ON0MVEOUb9uontggvrvBLOMzorD0cI,1125
|
|
148
152
|
memos/memos_tools/notification_utils.py,sha256=5J8GUqgf3h8uo1qFvrWawtcqTtu1irxCfSVsFOQfO3I,2380
|
|
153
|
+
memos/memos_tools/thread_safe_dict.py,sha256=5hhKndKntYIriTIkmaDaehmojuOMhEkVl4WAc2QLfHM,8252
|
|
149
154
|
memos/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
155
|
memos/parsers/base.py,sha256=AWgWIZzReDiTqiv6z08_9aG2KHVzc4Bdr0Lowz0mWVI,435
|
|
151
156
|
memos/parsers/factory.py,sha256=hPKTR0wVgMQ5Z9ZL-a9FyHWCpz9UcrG2oSEDYBAoB3g,704
|
|
152
157
|
memos/parsers/markitdown.py,sha256=SDwmZYC6LyiwdU79yuj6mWNMkQx9YrZzZEHU-4JzBwQ,863
|
|
153
158
|
memos/settings.py,sha256=BYOaqhzReu2yjbwrZqx9-uMwoipkj5Clc6VthnBYOvY,225
|
|
154
159
|
memos/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
155
|
-
memos/templates/mem_reader_prompts.py,sha256=
|
|
156
|
-
memos/templates/mem_scheduler_prompts.py,sha256=
|
|
157
|
-
memos/templates/mos_prompts.py,sha256=
|
|
158
|
-
memos/templates/tree_reorganize_prompts.py,sha256=
|
|
160
|
+
memos/templates/mem_reader_prompts.py,sha256=T6tJaGmHo7fqFxMSo6OOTY-GvITnv-Fa1CydYX40MiM,10095
|
|
161
|
+
memos/templates/mem_scheduler_prompts.py,sha256=ty_H9TARf5sQogHSJoRYQmrS6w0xs51mMcKNjkExdFc,5034
|
|
162
|
+
memos/templates/mos_prompts.py,sha256=sw_jAZOXEgmFHVA2xXfGb4nvhhr4IUkAi-rqFjX-HQ8,13793
|
|
163
|
+
memos/templates/tree_reorganize_prompts.py,sha256=FJRIwT2A4d5EnoPhNuzDFdMWpbNLlJEIfLZP69RBlDM,12112
|
|
159
164
|
memos/types.py,sha256=N7XBYxDTdc50KEsS6YxHvYgs23ykGsZ-wNnaJBVdVi4,1791
|
|
165
|
+
memos/utils.py,sha256=uB-8_5V16M7yNeAYXOIPaXwxeceUu4d_5yofLA6vbaE,428
|
|
160
166
|
memos/vec_dbs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
161
167
|
memos/vec_dbs/base.py,sha256=gbw7Gb_zs8Yx8kJIx6aTM-Ylsb4qLkVOFB-iwNJW6Sw,3564
|
|
162
168
|
memos/vec_dbs/factory.py,sha256=Noa4caqzPT9b59i2jzdpAHFCSHiMfDmgRox1POkRRfE,710
|
|
163
169
|
memos/vec_dbs/item.py,sha256=mLrcHF0nWtMCUjScBgaeeSqabQ3vJhKr_6wrU_g25ns,1425
|
|
164
170
|
memos/vec_dbs/qdrant.py,sha256=4KAiSZ64Ulz8EeT2o1DpNDRwnKRF4iiaJbZdq-xrn0c,11052
|
|
165
|
-
memoryos-0.
|
|
166
|
-
memoryos-0.
|
|
167
|
-
memoryos-0.
|
|
168
|
-
memoryos-0.
|
|
169
|
-
memoryos-0.
|
|
171
|
+
memoryos-1.0.0.dist-info/LICENSE,sha256=FU-b6N8tVc7dzUZGyNjUIG1Ihnrh2iuBziq4a1Gl8HU,11358
|
|
172
|
+
memoryos-1.0.0.dist-info/METADATA,sha256=uXoscqVd6NEZGEwaGQn3NR-ezJ5RKp0X6n48KANAmAY,15608
|
|
173
|
+
memoryos-1.0.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
174
|
+
memoryos-1.0.0.dist-info/entry_points.txt,sha256=p54si8po81Yb-NK2lx5Z0lNr8QV7-5IECtkC6c8MJmI,40
|
|
175
|
+
memoryos-1.0.0.dist-info/RECORD,,
|
memos/__init__.py
CHANGED
memos/api/config.py
CHANGED
|
@@ -100,9 +100,9 @@ class APIConfig:
|
|
|
100
100
|
"backend": "universal_api",
|
|
101
101
|
"config": {
|
|
102
102
|
"provider": os.getenv("MOS_EMBEDDER_PROVIDER", "openai"),
|
|
103
|
-
"api_key": os.getenv("
|
|
103
|
+
"api_key": os.getenv("MOS_EMBEDDER_API_KEY", "sk-xxxx"),
|
|
104
104
|
"model_name_or_path": os.getenv("MOS_EMBEDDER_MODEL", "text-embedding-3-large"),
|
|
105
|
-
"base_url": os.getenv("
|
|
105
|
+
"base_url": os.getenv("MOS_EMBEDDER_API_BASE", "http://openai.com"),
|
|
106
106
|
},
|
|
107
107
|
}
|
|
108
108
|
else: # ollama
|
|
@@ -120,10 +120,9 @@ class APIConfig:
|
|
|
120
120
|
def get_internet_config() -> dict[str, Any]:
|
|
121
121
|
"""Get embedder configuration."""
|
|
122
122
|
return {
|
|
123
|
-
"backend": "
|
|
123
|
+
"backend": "bocha",
|
|
124
124
|
"config": {
|
|
125
|
-
"api_key": os.getenv("
|
|
126
|
-
"search_engine_id": os.getenv("XINYU_SEARCH_ENGINE_ID"),
|
|
125
|
+
"api_key": os.getenv("BOCHA_API_KEY"),
|
|
127
126
|
"max_results": 15,
|
|
128
127
|
"num_per_request": 10,
|
|
129
128
|
"reader": {
|
|
@@ -137,7 +136,7 @@ class APIConfig:
|
|
|
137
136
|
"max_tokens": 5000,
|
|
138
137
|
"top_p": 0.95,
|
|
139
138
|
"top_k": 20,
|
|
140
|
-
"api_key": "EMPTY",
|
|
139
|
+
"api_key": os.getenv("MEMRADER_API_KEY", "EMPTY"),
|
|
141
140
|
"api_base": os.getenv("MEMRADER_API_BASE"),
|
|
142
141
|
"remove_think_prefix": True,
|
|
143
142
|
"extra_body": {"chat_template_kwargs": {"enable_thinking": False}},
|
|
@@ -252,7 +251,6 @@ class APIConfig:
|
|
|
252
251
|
"backend": "general_scheduler",
|
|
253
252
|
"config": {
|
|
254
253
|
"top_k": int(os.getenv("MOS_SCHEDULER_TOP_K", "10")),
|
|
255
|
-
"top_n": int(os.getenv("MOS_SCHEDULER_TOP_N", "5")),
|
|
256
254
|
"act_mem_update_interval": int(
|
|
257
255
|
os.getenv("MOS_SCHEDULER_ACT_MEM_UPDATE_INTERVAL", "300")
|
|
258
256
|
),
|
|
@@ -267,7 +265,7 @@ class APIConfig:
|
|
|
267
265
|
"MOS_SCHEDULER_ENABLE_PARALLEL_DISPATCH", "true"
|
|
268
266
|
).lower()
|
|
269
267
|
== "true",
|
|
270
|
-
"
|
|
268
|
+
"enable_activation_memory": True,
|
|
271
269
|
},
|
|
272
270
|
}
|
|
273
271
|
|
memos/api/context/context.py
CHANGED
|
@@ -122,7 +122,7 @@ def set_trace_id_getter(getter: TraceIdGetter) -> None:
|
|
|
122
122
|
Set a custom trace_id getter function.
|
|
123
123
|
|
|
124
124
|
This allows the logging system to retrieve trace_id without importing
|
|
125
|
-
API-specific
|
|
125
|
+
API-specific general_modules.
|
|
126
126
|
"""
|
|
127
127
|
global _trace_id_getter
|
|
128
128
|
_trace_id_getter = getter
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
|
|
3
4
|
from fastapi import Depends, Header, Request
|
|
4
5
|
|
|
@@ -24,6 +25,13 @@ def get_trace_id_from_header(
|
|
|
24
25
|
return g_trace_id or x_trace_id or trace_id
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
def generate_trace_id() -> str:
|
|
29
|
+
"""
|
|
30
|
+
Get a random trace_id.
|
|
31
|
+
"""
|
|
32
|
+
return os.urandom(16).hex()
|
|
33
|
+
|
|
34
|
+
|
|
27
35
|
def get_request_context(
|
|
28
36
|
request: Request, trace_id: str | None = Depends(get_trace_id_from_header)
|
|
29
37
|
) -> RequestContext:
|
|
@@ -57,6 +65,9 @@ def get_g_object(trace_id: str | None = Depends(get_trace_id_from_header)) -> G:
|
|
|
57
65
|
This creates a RequestContext and sets it globally for access
|
|
58
66
|
throughout the request lifecycle.
|
|
59
67
|
"""
|
|
68
|
+
if trace_id is None:
|
|
69
|
+
trace_id = generate_trace_id()
|
|
70
|
+
|
|
60
71
|
g = RequestContext(trace_id=trace_id)
|
|
61
72
|
set_request_context(g)
|
|
62
73
|
logger.info(f"Request g object created with trace_id: {g.trace_id}")
|
|
@@ -55,6 +55,18 @@ class XinyuSearchConfig(BaseInternetRetrieverConfig):
|
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
class BochaSearchConfig(BaseInternetRetrieverConfig):
|
|
59
|
+
"""Configuration class for Bocha Search API."""
|
|
60
|
+
|
|
61
|
+
max_results: int = Field(default=20, description="Maximum number of results to retrieve")
|
|
62
|
+
num_per_request: int = Field(default=10, description="Number of results per API request")
|
|
63
|
+
reader: MemReaderConfigFactory = Field(
|
|
64
|
+
...,
|
|
65
|
+
default_factory=MemReaderConfigFactory,
|
|
66
|
+
description="Reader configuration",
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
58
70
|
class InternetRetrieverConfigFactory(BaseConfig):
|
|
59
71
|
"""Factory class for creating internet retriever configurations."""
|
|
60
72
|
|
|
@@ -69,6 +81,7 @@ class InternetRetrieverConfigFactory(BaseConfig):
|
|
|
69
81
|
"google": GoogleCustomSearchConfig,
|
|
70
82
|
"bing": BingSearchConfig,
|
|
71
83
|
"xinyu": XinyuSearchConfig,
|
|
84
|
+
"bocha": BochaSearchConfig,
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
@field_validator("backend")
|
memos/configs/mem_scheduler.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing import Any, ClassVar
|
|
|
6
6
|
from pydantic import ConfigDict, Field, field_validator, model_validator
|
|
7
7
|
|
|
8
8
|
from memos.configs.base import BaseConfig
|
|
9
|
-
from memos.mem_scheduler.
|
|
9
|
+
from memos.mem_scheduler.general_modules.misc import DictConversionMixin
|
|
10
10
|
from memos.mem_scheduler.schemas.general_schemas import (
|
|
11
11
|
BASE_DIR,
|
|
12
12
|
DEFAULT_ACT_MEM_DUMP_PATH,
|
|
@@ -21,8 +21,6 @@ class BaseSchedulerConfig(BaseConfig):
|
|
|
21
21
|
top_k: int = Field(
|
|
22
22
|
default=10, description="Number of top candidates to consider in initial retrieval"
|
|
23
23
|
)
|
|
24
|
-
# TODO: The 'top_n' field is deprecated and will be removed in future versions.
|
|
25
|
-
top_n: int = Field(default=5, description="Number of final results to return after processing")
|
|
26
24
|
enable_parallel_dispatch: bool = Field(
|
|
27
25
|
default=True, description="Whether to enable parallel message processing using thread pool"
|
|
28
26
|
)
|
|
@@ -45,6 +43,7 @@ class BaseSchedulerConfig(BaseConfig):
|
|
|
45
43
|
|
|
46
44
|
|
|
47
45
|
class GeneralSchedulerConfig(BaseSchedulerConfig):
|
|
46
|
+
model_config = ConfigDict(extra="ignore", strict=True)
|
|
48
47
|
act_mem_update_interval: int | None = Field(
|
|
49
48
|
default=300, description="Interval in seconds for updating activation memory"
|
|
50
49
|
)
|
|
@@ -55,9 +54,15 @@ class GeneralSchedulerConfig(BaseSchedulerConfig):
|
|
|
55
54
|
default=DEFAULT_ACT_MEM_DUMP_PATH, # Replace with DEFAULT_ACT_MEM_DUMP_PATH
|
|
56
55
|
description="File path for dumping activation memory",
|
|
57
56
|
)
|
|
58
|
-
|
|
57
|
+
enable_activation_memory: bool = Field(
|
|
59
58
|
default=False, description="Whether to enable automatic activation memory updates"
|
|
60
59
|
)
|
|
60
|
+
working_mem_monitor_capacity: int = Field(
|
|
61
|
+
default=30, description="Capacity of the working memory monitor"
|
|
62
|
+
)
|
|
63
|
+
activation_mem_monitor_capacity: int = Field(
|
|
64
|
+
default=20, description="Capacity of the activation memory monitor"
|
|
65
|
+
)
|
|
61
66
|
|
|
62
67
|
|
|
63
68
|
class SchedulerConfigFactory(BaseConfig):
|
|
@@ -137,29 +142,46 @@ class AuthConfig(BaseConfig, DictConversionMixin):
|
|
|
137
142
|
)
|
|
138
143
|
|
|
139
144
|
@classmethod
|
|
140
|
-
def
|
|
145
|
+
def from_local_config(cls, config_path: str | Path | None = None) -> "AuthConfig":
|
|
141
146
|
"""
|
|
142
|
-
Load configuration from YAML file
|
|
147
|
+
Load configuration from either a YAML or JSON file based on file extension.
|
|
148
|
+
|
|
149
|
+
Automatically detects file type (YAML or JSON) from the file extension
|
|
150
|
+
and uses the appropriate parser. If no path is provided, uses the default
|
|
151
|
+
configuration path (YAML) or its JSON counterpart.
|
|
143
152
|
|
|
144
153
|
Args:
|
|
145
|
-
config_path:
|
|
154
|
+
config_path: Optional path to configuration file.
|
|
155
|
+
If not provided, uses default configuration path.
|
|
146
156
|
|
|
147
157
|
Returns:
|
|
148
|
-
AuthConfig instance
|
|
158
|
+
AuthConfig instance populated with data from the configuration file.
|
|
149
159
|
|
|
150
160
|
Raises:
|
|
151
|
-
FileNotFoundError: If
|
|
152
|
-
ValueError: If
|
|
161
|
+
FileNotFoundError: If the specified or default configuration file does not exist.
|
|
162
|
+
ValueError: If file extension is not .yaml/.yml or .json, or if parsing fails.
|
|
153
163
|
"""
|
|
154
|
-
|
|
164
|
+
# Determine config path
|
|
155
165
|
if config_path is None:
|
|
156
166
|
config_path = cls.default_config_path
|
|
157
167
|
|
|
158
|
-
#
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
# Validate file existence
|
|
169
|
+
config_path_obj = Path(config_path)
|
|
170
|
+
if not config_path_obj.exists():
|
|
171
|
+
raise FileNotFoundError(f"Configuration file not found: {config_path}")
|
|
172
|
+
|
|
173
|
+
# Get file extension and determine parser
|
|
174
|
+
file_ext = config_path_obj.suffix.lower()
|
|
175
|
+
|
|
176
|
+
if file_ext in (".yaml", ".yml"):
|
|
177
|
+
return cls.from_yaml_file(yaml_path=str(config_path_obj))
|
|
178
|
+
elif file_ext == ".json":
|
|
179
|
+
return cls.from_json_file(json_path=str(config_path_obj))
|
|
180
|
+
else:
|
|
181
|
+
raise ValueError(
|
|
182
|
+
f"Unsupported file format: {file_ext}. "
|
|
183
|
+
"Please use YAML (.yaml, .yml) or JSON (.json) files."
|
|
184
|
+
)
|
|
163
185
|
|
|
164
186
|
def set_openai_config_to_environment(self):
|
|
165
187
|
# Set environment variables
|
memos/graph_dbs/base.py
CHANGED
|
@@ -70,15 +70,27 @@ class BaseGraphDB(ABC):
|
|
|
70
70
|
|
|
71
71
|
# Graph Query & Reasoning
|
|
72
72
|
@abstractmethod
|
|
73
|
-
def get_node(self, id: str) -> dict[str, Any] | None:
|
|
73
|
+
def get_node(self, id: str, include_embedding: bool = False) -> dict[str, Any] | None:
|
|
74
74
|
"""
|
|
75
75
|
Retrieve the metadata and content of a node.
|
|
76
76
|
Args:
|
|
77
77
|
id: Node identifier.
|
|
78
|
+
include_embedding: with/without embedding
|
|
78
79
|
Returns:
|
|
79
80
|
Dictionary of node fields, or None if not found.
|
|
80
81
|
"""
|
|
81
82
|
|
|
83
|
+
@abstractmethod
|
|
84
|
+
def get_nodes(self, id: str, include_embedding: bool = False) -> dict[str, Any] | None:
|
|
85
|
+
"""
|
|
86
|
+
Retrieve the metadata and memory of a list of nodes.
|
|
87
|
+
Args:
|
|
88
|
+
ids: List of Node identifier.
|
|
89
|
+
include_embedding: with/without embedding
|
|
90
|
+
Returns:
|
|
91
|
+
list[dict]: Parsed node records containing 'id', 'memory', and 'metadata'.
|
|
92
|
+
"""
|
|
93
|
+
|
|
82
94
|
@abstractmethod
|
|
83
95
|
def get_neighbors(
|
|
84
96
|
self, id: str, type: str, direction: Literal["in", "out", "both"] = "out"
|
|
@@ -163,7 +175,9 @@ class BaseGraphDB(ABC):
|
|
|
163
175
|
"""
|
|
164
176
|
|
|
165
177
|
@abstractmethod
|
|
166
|
-
def get_structure_optimization_candidates(
|
|
178
|
+
def get_structure_optimization_candidates(
|
|
179
|
+
self, scope: str, include_embedding: bool = False
|
|
180
|
+
) -> list[dict]:
|
|
167
181
|
"""
|
|
168
182
|
Find nodes that are likely candidates for structure optimization:
|
|
169
183
|
- Isolated nodes, nodes with empty background, or nodes with exactly one child.
|
|
@@ -205,7 +219,7 @@ class BaseGraphDB(ABC):
|
|
|
205
219
|
"""
|
|
206
220
|
|
|
207
221
|
@abstractmethod
|
|
208
|
-
def export_graph(self) -> dict[str, Any]:
|
|
222
|
+
def export_graph(self, include_embedding: bool = False) -> dict[str, Any]:
|
|
209
223
|
"""
|
|
210
224
|
Export the entire graph as a serializable dictionary.
|
|
211
225
|
|
|
@@ -221,3 +235,16 @@ class BaseGraphDB(ABC):
|
|
|
221
235
|
Args:
|
|
222
236
|
data: A dictionary containing all nodes and edges to be loaded.
|
|
223
237
|
"""
|
|
238
|
+
|
|
239
|
+
@abstractmethod
|
|
240
|
+
def get_all_memory_items(self, scope: str, include_embedding: bool = False) -> list[dict]:
|
|
241
|
+
"""
|
|
242
|
+
Retrieve all memory items of a specific memory_type.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
scope (str): Must be one of 'WorkingMemory', 'LongTermMemory', or 'UserMemory'.
|
|
246
|
+
include_embedding: with/without embedding
|
|
247
|
+
|
|
248
|
+
Returns:
|
|
249
|
+
list[dict]: Full list of memory items under this scope.
|
|
250
|
+
"""
|