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.

fix: fix core memory limits hardcoded (draw from constant instead) (#2157)

Charles Packerf184a68e6a35
diff --git a/letta/cli/cli.py b/letta/cli/cli.py
index 4ee55f28d..8634d071c 100644
--- a/letta/cli/cli.py
+++ b/letta/cli/cli.py
@@ -10,7 +10,12 @@ import letta.utils as utils
from letta import create_client
from letta.agent import Agent, save_agent
from letta.config import LettaConfig
-from letta.constants import CLI_WARNING_PREFIX, LETTA_DIR, MIN_CONTEXT_WINDOW
+from letta.constants import (
+ CLI_WARNING_PREFIX,
+ CORE_MEMORY_BLOCK_CHAR_LIMIT,
+ LETTA_DIR,
+ MIN_CONTEXT_WINDOW,
+)
from letta.local_llm.constants import ASSISTANT_MESSAGE_CLI_SYMBOL
from letta.log import get_logger
from letta.metadata import MetadataStore
@@ -91,7 +96,7 @@ def run(
] = None,
core_memory_limit: Annotated[
Optional[int], typer.Option(help="The character limit to each core-memory section (human/persona).")
- ] = 2000,
+ ] = CORE_MEMORY_BLOCK_CHAR_LIMIT,
# other
first: Annotated[bool, typer.Option(help="Use --first to send the first message in the sequence")] = False,
strip_ui: Annotated[bool, typer.Option(help="Remove all the bells and whistles in CLI output (helpful for testing)")] = False,
diff --git a/letta/schemas/block.py b/letta/schemas/block.py
index b48bdbbce..25e84b7da 100644
--- a/letta/schemas/block.py
+++ b/letta/schemas/block.py
@@ -3,6 +3,7 @@ from typing import Optional
from pydantic import BaseModel, Field, model_validator
from typing_extensions import Self
+from letta.constants import CORE_MEMORY_BLOCK_CHAR_LIMIT
from letta.schemas.letta_base import LettaBase
# block of the LLM context
@@ -15,7 +16,7 @@ class BaseBlock(LettaBase, validate_assignment=True):
# data value
value: str = Field(..., description="Value of the block.")
- limit: int = Field(2000, description="Character limit of the block.")
+ limit: int = Field(CORE_MEMORY_BLOCK_CHAR_LIMIT, description="Character limit of the block.")
# template data (optional)
template_name: Optional[str] = Field(None, description="Name of the block if it is a template.", alias="name")
@@ -117,7 +118,7 @@ class BlockLabelUpdate(BaseModel):
class BlockUpdate(BaseBlock):
"""Update a block"""
- limit: Optional[int] = Field(2000, description="Character limit of the block.")
+ limit: Optional[int] = Field(CORE_MEMORY_BLOCK_CHAR_LIMIT, description="Character limit of the block.")
value: Optional[str] = Field(None, description="Value of the block.")
class Config:
@@ -147,7 +148,7 @@ class CreateBlock(BaseBlock):
"""Create a block"""
label: str = Field(..., description="Label of the block.")
- limit: int = Field(2000, description="Character limit of the block.")
+ limit: int = Field(CORE_MEMORY_BLOCK_CHAR_LIMIT, description="Character limit of the block.")
value: str = Field(..., description="Value of the block.")
# block templates