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.

Add warning if no data sources loaded on `/attach` command (#513)

Sarah Woodersfe6be5c3bd14
diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.py
index cea2ab2a5..37eb0f927 100644
--- a/memgpt/cli/cli_config.py
+++ b/memgpt/cli/cli_config.py
@@ -64,7 +64,7 @@ def configure_llm_endpoint(config: MemGPTConfig):
if config.model_endpoint_type in backend_options:
# set from previous config
default_model_endpoint_type = config.model_endpoint_type
- else:
+ if os.getenv("BACKEND_TYPE") and os.getenv("BACKEND_TYPE") in backend_options:
# set form env variable (ok if none)
default_model_endpoint_type = os.getenv("BACKEND_TYPE")
model_endpoint_type = questionary.select(
diff --git a/memgpt/main.py b/memgpt/main.py
index 48972ecbc..75ffd7eb5 100644
--- a/memgpt/main.py
+++ b/memgpt/main.py
@@ -457,6 +457,13 @@ def run_agent_loop(memgpt_agent, first, no_verify=False, cfg=None, strip_ui=Fals
# TODO: check if agent already has it
data_source_options = StorageConnector.list_loaded_data()
+ if len(data_source_options) == 0:
+ typer.secho(
+ 'No sources available. You must load a souce with "memgpt load ..." before running /attach.',
+ fg=typer.colors.RED,
+ bold=True,
+ )
+ continue
data_source = questionary.select("Select data source", choices=data_source_options).ask()
# attach new data