Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: misc fixes (bad link to old docs, composio print statement, context window selection) (#1992)
Charles Packer1c94e4c6c05c
diff --git a/letta/cli/cli.py b/letta/cli/cli.pyindex e3f92285a..1afdba1b1 100644--- a/letta/cli/cli.py+++ b/letta/cli/cli.py@@ -10,7 +10,7 @@ import letta.utils as utilsfrom letta import create_clientfrom letta.agent import Agent, save_agentfrom letta.config import LettaConfig-from letta.constants import CLI_WARNING_PREFIX, LETTA_DIR+from letta.constants import CLI_WARNING_PREFIX, LETTA_DIR, MIN_CONTEXT_WINDOWfrom letta.local_llm.constants import ASSISTANT_MESSAGE_CLI_SYMBOLfrom letta.log import get_loggerfrom letta.metadata import MetadataStore@@ -244,6 +244,19 @@ def run(llm_model_name = questionary.select("Select LLM model:", choices=llm_choices).ask().modelllm_config = [llm_config for llm_config in llm_configs if llm_config.model == llm_model_name][0]+ # option to override context window+ if llm_config.context_window is not None:+ context_window_validator = lambda x: x.isdigit() and int(x) > MIN_CONTEXT_WINDOW and int(x) <= llm_config.context_window+ context_window_input = questionary.text(+ "Select LLM context window limit (hit enter for default):",+ default=str(llm_config.context_window),+ validate=context_window_validator,+ ).ask()+ if context_window_input is not None:+ llm_config.context_window = int(context_window_input)+ else:+ sys.exit(1)+# choose form list of embedding configsembedding_configs = client.list_embedding_configs()embedding_options = [embedding_config.embedding_model for embedding_config in embedding_configs]diff --git a/letta/constants.py b/letta/constants.pyindex fdce01ad8..eddb82c87 100644--- a/letta/constants.py+++ b/letta/constants.py@@ -18,6 +18,9 @@ IN_CONTEXT_MEMORY_KEYWORD = "CORE_MEMORY"# OpenAI error message: Invalid 'messages[1].tool_calls[0].id': string too long. Expected a string with maximum length 29, but got a string with length 36 instead.TOOL_CALL_ID_MAX_LEN = 29+# minimum context window size+MIN_CONTEXT_WINDOW = 4000+# embeddingsMAX_EMBEDDING_DIM = 4096 # maximum supported embeding size - do NOT change or else DBs will need to be resetdiff --git a/letta/main.py b/letta/main.pyindex bca3c34a9..70595d6c8 100644--- a/letta/main.py+++ b/letta/main.py@@ -26,6 +26,9 @@ from letta.streaming_interface import AgentRefreshStreamingInterface# interface = interface()+# disable composio print on exit+os.environ["COMPOSIO_DISABLE_VERSION_CHECK"] = "true"+app = typer.Typer(pretty_exceptions_enable=False)app.command(name="run")(run)app.command(name="version")(version)diff --git a/main.py b/main.pyindex 72be80d58..2c597e20f 100644--- a/main.py+++ b/main.py@@ -1,6 +1,6 @@import typertyper.secho(- "Command `python main.py` no longer supported. Please run `letta run`. See https://letta.readme.io/docs/quickstart.",+ "Command `python main.py` no longer supported. Please run `letta run`. See https://docs.letta.com for more info.",fg=typer.colors.YELLOW,)diff --git a/tests/test_cli.py b/tests/test_cli.pyindex 2b6c00b2f..32fa1daff 100644--- a/tests/test_cli.py+++ b/tests/test_cli.py@@ -49,6 +49,13 @@ def test_letta_run_create_new_agent(swap_letta_config):except (pexpect.TIMEOUT, pexpect.EOF):print("[WARNING] LLM model selection step was skipped.")+ # Optional: Context window selection+ try:+ child.expect("Select LLM context window limit", timeout=20)+ child.sendline("")+ except (pexpect.TIMEOUT, pexpect.EOF):+ print("[WARNING] Context window selection step was skipped.")+# Optional: Embedding model selectiontry:child.expect("Select embedding model:", timeout=20)@@ -63,6 +70,7 @@ def test_letta_run_create_new_agent(swap_letta_config):child.expect("Enter your message:", timeout=60)# Capture the output up to this pointfull_output = child.before+ assert full_output is not None, "No output was captured."# Count occurrences of inner thoughtscloud_emoji_count = full_output.count(INNER_THOUGHTS_CLI_SYMBOL)assert cloud_emoji_count == 1, f"It appears that there are multiple instances of inner thought outputted."