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.

feat: add character limits for persona/human to /config response

robingotz6355d9f8defb
diff --git a/memgpt/config.py b/memgpt/config.py
index cfda1a70e..225c6e5d9 100644
--- a/memgpt/config.py
+++ b/memgpt/config.py
@@ -7,7 +7,14 @@ from dataclasses import dataclass
import memgpt
import memgpt.utils as utils
-from memgpt.constants import DEFAULT_HUMAN, DEFAULT_PERSONA, DEFAULT_PRESET, MEMGPT_DIR
+from memgpt.constants import (
+ CORE_MEMORY_HUMAN_CHAR_LIMIT,
+ CORE_MEMORY_PERSONA_CHAR_LIMIT,
+ DEFAULT_HUMAN,
+ DEFAULT_PERSONA,
+ DEFAULT_PRESET,
+ MEMGPT_DIR,
+)
from memgpt.data_types import AgentState, EmbeddingConfig, LLMConfig
from memgpt.log import get_logger
@@ -76,6 +83,10 @@ class MemGPTConfig:
# user info
policies_accepted: bool = False
+ # Default memory limits
+ core_memory_persona_char_limit: int = CORE_MEMORY_PERSONA_CHAR_LIMIT
+ core_memory_human_char_limit: int = CORE_MEMORY_HUMAN_CHAR_LIMIT
+
def __post_init__(self):
# ensure types
# self.embedding_chunk_size = int(self.embedding_chunk_size)
diff --git a/memgpt/server/server.py b/memgpt/server/server.py
index d2c7956da..a890d7c17 100644
--- a/memgpt/server/server.py
+++ b/memgpt/server/server.py
@@ -1215,15 +1215,19 @@ class SyncServer(LockingServer):
# TODO: do we need a seperate server config?
base_config = vars(self.config)
clean_base_config = clean_keys(base_config)
- clean_base_config["default_llm_config"] = vars(clean_base_config["default_llm_config"])
- clean_base_config["default_embedding_config"] = vars(clean_base_config["default_embedding_config"])
+
+ clean_base_config_default_llm_config_dict = vars(clean_base_config["default_llm_config"])
+ clean_base_config_default_embedding_config_dict = vars(clean_base_config["default_embedding_config"])
+
+ clean_base_config["default_llm_config"] = clean_base_config_default_llm_config_dict
+ clean_base_config["default_embedding_config"] = clean_base_config_default_embedding_config_dict
response = {"config": clean_base_config}
if include_defaults:
default_config = vars(MemGPTConfig())
clean_default_config = clean_keys(default_config)
- clean_default_config["default_llm_config"] = vars(clean_default_config["default_llm_config"])
- clean_default_config["default_embedding_config"] = vars(clean_default_config["default_embedding_config"])
+ clean_default_config["default_llm_config"] = clean_base_config_default_llm_config_dict
+ clean_default_config["default_embedding_config"] = clean_base_config_default_embedding_config_dict
response["defaults"] = clean_default_config
return response