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.

[cpacker#319] Refactor memgptlog.py to log.py and move a function to log.py

Max Blackmer5733f0418d87
diff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.py
index 9196baec3..93b9b3054 100644
--- a/memgpt/cli/cli.py
+++ b/memgpt/cli/cli.py
@@ -13,7 +13,7 @@ from enum import Enum
from llama_index import set_global_service_context
from llama_index import ServiceContext
-from memgpt.memgptlog import logger
+from memgpt.log import logger
from memgpt.interface import CLIInterface as interface # for printing to terminal
from memgpt.cli.cli_config import configure
import memgpt.presets.presets as presets
diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.py
index 4b2cc55f3..8203a5e59 100644
--- a/memgpt/cli/cli_config.py
+++ b/memgpt/cli/cli_config.py
@@ -6,7 +6,7 @@ import os
import shutil
# from global logging configuration
-from memgpt.memgptlog import logger
+from memgpt.log import logger
# from memgpt.cli import app
from memgpt import utils
diff --git a/memgpt/config.py b/memgpt/config.py
index d81f76e22..804e7bf34 100644
--- a/memgpt/config.py
+++ b/memgpt/config.py
@@ -1,6 +1,6 @@
import logging
import logging.config
-from memgpt.memgptlog import logger, reload_logger
+from memgpt.log import logger, reload_logger, fix_file_path
import inspect
import json
import os
diff --git a/memgpt/memgptlog.py b/memgpt/log.py
similarity index 57%
rename from memgpt/memgptlog.py
rename to memgpt/log.py
index 38ae260f1..8151cd990 100644
--- a/memgpt/memgptlog.py
+++ b/memgpt/log.py
@@ -10,3 +10,11 @@ def reload_logger():
global logger # This is required to modify the global 'logger'
# Reconfigure logger
logger = logging.getLogger(LOGGER_NAME)
+
+
+def fix_file_path(path):
+ """
+ Converts backslashes to forward slashes in a file path.
+ This is useful for ensuring compatibility in file paths across different systems.
+ """
+ return path.replace("\\", "/")
diff --git a/memgpt/main.py b/memgpt/main.py
index 19ff43c81..d5c2335e5 100644
--- a/memgpt/main.py
+++ b/memgpt/main.py
@@ -17,7 +17,7 @@ from prettytable import PrettyTable
console = Console()
-from memgpt.memgptlog import logger
+from memgpt.log import logger
from memgpt.interface import CLIInterface as interface # for printing to terminal
import memgpt.agent as agent
import memgpt.system as system
diff --git a/memgpt/utils.py b/memgpt/utils.py
index 5b720d83e..8e864a423 100644
--- a/memgpt/utils.py
+++ b/memgpt/utils.py
@@ -288,11 +288,3 @@ def get_schema_diff(schema_a, schema_b):
difference = [line for line in difference if line.startswith("+ ") or line.startswith("- ")]
return "".join(difference)
-
-
-def fix_file_path(path):
- """
- Converts backslashes to forward slashes in a file path.
- This is useful for ensuring compatibility in file paths across different systems.
- """
- return path.replace("\\", "/")