From f47247d4b464fe3d18fcbee3ceb427f7ec9c960c Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Wed, 8 Nov 2023 21:35:35 -0800 Subject: [PATCH] Allow overriding config location with `MEMGPT_CONFIG_PATH` (#383) --- docs/config.md | 8 +++++++- memgpt/config.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/config.md b/docs/config.md index d6f5d1bb..1a390495 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1,5 +1,5 @@ ### Configuring the agent -You can set agent defaults by running `memgpt configure`. +You can set agent defaults by running `memgpt configure`, which will store config information at `~/.memgpt/config` by default. The `memgpt run` command supports the following optional flags (if set, will override config defaults): @@ -13,6 +13,12 @@ The `memgpt run` command supports the following optional flags (if set, will ove * `--no-verify`: (bool) Bypass message verification (default=False) * `--yes`/`-y`: (bool) Skip confirmation prompt and use defaults (default=False) +#### Updating the config location +You can override the location of the config path by setting the enviornment variable `MEMGPT_CONFIG_PATH`: +``` +export MEMGPT_CONFIG_PATH=/my/custom/path/config # make sure this is a file, not a directory +``` + ### Adding Custom Personas/Humans You can add new human or persona definitions either by providing a file (using the `-f` flag) or text (using the `--text` flag). diff --git a/memgpt/config.py b/memgpt/config.py index 30fe5306..4dfe1640 100644 --- a/memgpt/config.py +++ b/memgpt/config.py @@ -228,6 +228,8 @@ class MemGPTConfig: config_path = os.getenv("MEMGPT_CONFIG_PATH") else: config_path = MemGPTConfig.config_path + + assert not os.path.isdir(config_path), f"Config path {config_path} cannot be set to a directory." return os.path.exists(config_path) @staticmethod