Rename embedchain to mem0 and open sourcing code for long term memory (#1474)

Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
This commit is contained in:
Taranjeet Singh
2024-07-12 07:51:33 -07:00
committed by GitHub
parent 83e8c97295
commit f842a92e25
665 changed files with 9427 additions and 6592 deletions

28
mem0/memory/setup.py Normal file
View File

@@ -0,0 +1,28 @@
import json
import os
import uuid
# Set up the directory path
home_dir = os.path.expanduser("~")
mem0_dir = os.path.join(home_dir, ".mem0")
os.makedirs(mem0_dir, exist_ok=True)
def setup_config():
config_path = os.path.join(mem0_dir, "config.json")
if not os.path.exists(config_path):
user_id = str(uuid.uuid4())
config = {"user_id": user_id}
with open(config_path, "w") as config_file:
json.dump(config, config_file, indent=4)
def get_user_id():
config_path = os.path.join(mem0_dir, "config.json")
if os.path.exists(config_path):
with open(config_path, "r") as config_file:
config = json.load(config_file)
user_id = config.get("user_id")
return user_id
else:
return "anonymous_user"