Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

Merge branch 'main' into feature/global-logging

Max Blackmer, CSMebbd176e71c3
diff --cc memgpt/cli/cli.py
index 5f2463a65,cf482c993..9196baec3
--- a/memgpt/cli/cli.py
+++ b/memgpt/cli/cli.py
@@@ -139,22 -295,49 +296,52 @@@ def run
"""
# setup logger
+ # TODO: remove Utils Debug after global logging is complete.
utils.DEBUG = debug
- logging.getLogger().setLevel(logging.CRITICAL)
- if debug:
- logging.getLogger().setLevel(logging.DEBUG)
+ # TODO: add logging command line options for runtime log level
+ if debug:
+ logger.setLevel(logging.DEBUG)
+ else:
+ logger.setLevel(logging.CRITICAL)
- if not MemGPTConfig.exists(): # if no config, run configure
+ if not MemGPTConfig.exists():
+ # if no config, ask about quickstart
+ # do you want to do:
+ # - openai (run quickstart)
+ # - memgpt hosted (run quickstart)
+ # - other (run configure)
if yes:
- # use defaults
+ # if user is passing '-y' to bypass all inputs, use memgpt hosted
+ # since it can't fail out if you don't have an API key
+ quickstart(backend=QuickstartChoice.memgpt_hosted)
config = MemGPTConfig()
+
else:
- # use input
- configure()
+ config_choices = {
+ "memgpt": "Use the free MemGPT endpoints",
+ "openai": "Use OpenAI (requires an OpenAI API key)",
+ "other": "Other (OpenAI Azure, custom LLM endpoint, etc)",
+ }
+ print()
+ config_selection = questionary.select(
+ "How would you like to set up MemGPT?",
+ choices=list(config_choices.values()),
+ default=config_choices["memgpt"],
+ ).ask()
+
+ if config_selection == config_choices["memgpt"]:
+ print()
+ quickstart(backend=QuickstartChoice.memgpt_hosted, debug=debug, terminal=False, latest=False)
+ elif config_selection == config_choices["openai"]:
+ print()
+ quickstart(backend=QuickstartChoice.openai, debug=debug, terminal=False, latest=False)
+ elif config_selection == config_choices["other"]:
+ configure()
+ else:
+ raise ValueError(config_selection)
+
config = MemGPTConfig.load()
+
else: # load config
config = MemGPTConfig.load()
diff --cc memgpt/config.py
index 107586693,10d01095a..d81f76e22
--- a/memgpt/config.py
+++ b/memgpt/config.py
@@@ -87,14 -84,9 +87,17 @@@ class MemGPTConfig
# version (for backcompat)
memgpt_version: str = None
+ # logging (for logger)
+ logging_level: str = "CRITICAL" # default log level
+ logging_enable_logfile: bool = True
+ logging_backup_count: int = 3
+ logging_max_file_bytes: int = 10 * 1024 * 1024 # 10 MB in bytes
+ logging_logdir: str = os.path.join(MEMGPT_DIR, "logs")
+ logging_logpathname: str = os.path.join(logging_logdir, "memgpt.log")
+
+ # user info
+ policies_accepted: bool = False
+
def __post_init__(self):
# ensure types
self.embedding_chunk_size = int(self.embedding_chunk_size)
@@@ -308,7 -216,7 +311,8 @@@
if not os.path.exists(MEMGPT_DIR):
os.makedirs(MEMGPT_DIR, exist_ok=True)
- folders = ["personas", "humans", "archival", "agents", "functions", "system_prompts", "presets", "logs"]
- folders = ["personas", "humans", "archival", "agents", "functions", "system_prompts", "presets", "settings"]
++ folders = ["personas", "humans", "archival", "agents", "functions", "system_prompts", "presets", "settings", "logs"]
++
for folder in folders:
if not os.path.exists(os.path.join(MEMGPT_DIR, folder)):
os.makedirs(os.path.join(MEMGPT_DIR, folder))