MCPcopy Create free account
hub / github.com/MemTensor/MemOS / dump

Method dump

src/memos/mem_os/core.py:1089–1107  ·  view source on GitHub ↗

Dump the MemCube to a dictionary. Args: dump_dir (str): The directory to dump the MemCube to. user_id (str, optional): The identifier of the user to dump the MemCube from. If None, the default user is used. mem_cube_id (str, optional): The

(
        self, dump_dir: str, user_id: str | None = None, mem_cube_id: str | None = None
    )

Source from the content-addressed store, hash-verified

1087 logger.info(f"MemCube {mem_cube_id} deleted all memories")
1088
1089 def dump(
1090 self, dump_dir: str, user_id: str | None = None, mem_cube_id: str | None = None
1091 ) -> None:
1092 """Dump the MemCube to a dictionary.
1093 Args:
1094 dump_dir (str): The directory to dump the MemCube to.
1095 user_id (str, optional): The identifier of the user to dump the MemCube from.
1096 If None, the default user is used.
1097 mem_cube_id (str, optional): The identifier of the MemCube to dump.
1098 If None, the default MemCube for the user is used.
1099 """
1100 target_user_id = user_id if user_id is not None else self.user_id
1101 accessible_cubes = self.user_manager.get_user_cubes(target_user_id)
1102 if not mem_cube_id:
1103 mem_cube_id = accessible_cubes[0].cube_id
1104 if mem_cube_id not in self.mem_cubes:
1105 raise ValueError(f"MemCube with ID {mem_cube_id} does not exist. please regiester")
1106 self.mem_cubes[mem_cube_id].dump(dump_dir)
1107 logger.info(f"MemCube {mem_cube_id} dumped to {dump_dir}")
1108
1109 def load(
1110 self,

Callers 15

export_openapiFunction · 0.45
mainFunction · 0.45
dump_cubeMethod · 0.45
test_from_json_fileFunction · 0.45
test_load_and_dumpMethod · 0.45
kv_cache_memory.pyFile · 0.45
mainFunction · 0.45

Calls 2

infoMethod · 0.65
get_user_cubesMethod · 0.45

Tested by 4

test_from_json_fileFunction · 0.36
test_load_and_dumpMethod · 0.36