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.

Merge branch 'main' into cherry-pick-storage-refactor

cpackerb022b6e1720f
diff --cc memgpt/cli/cli_config.py
index 05ef4b60d,fc5025999..7718a7d36
--- a/memgpt/cli/cli_config.py
+++ b/memgpt/cli/cli_config.py
@@@ -536,25 -523,29 +545,25 @@@ def list(arg: Annotated[ListChoice, typ
name = os.path.basename(persona_file).replace(".txt", "")
table.add_row([name, text])
print(table)
- elif option == "sources":
+ elif arg == ListChoice.sources:
"""List all data sources"""
+ conn = StorageConnector.get_metadata_storage_connector(table_type=TableType.DATA_SOURCES) # already filters by user
+ passage_conn = StorageConnector.get_storage_connector(table_type=TableType.PASSAGES)
+
+ # create table
table = PrettyTable()
- table.field_names = ["Name", "Location", "Agents"]
- config = MemGPTConfig.load()
+ table.field_names = ["Name", "Created At", "Number of Passages", "Agents"]
# TODO: eventually look accross all storage connections
# TODO: add data source stats
- source_to_agents = {}
- for agent_file in utils.list_agent_config_files():
- agent_name = os.path.basename(agent_file).replace(".json", "")
- agent_config = AgentConfig.load(agent_name)
- for ds in agent_config.data_sources:
- if ds in source_to_agents:
- source_to_agents[ds].append(agent_name)
- else:
- source_to_agents[ds] = [agent_name]
- for data_source in StorageConnector.list_loaded_data():
- location = config.archival_storage_type
- agents = ",".join(source_to_agents[data_source]) if data_source in source_to_agents else ""
- table.add_row([data_source, location, agents])
+ # TODO: connect to agents
+
+ # get all sources
+ for data_source in conn.get_all():
+ num_passages = passage_conn.size({"data_source": data_source.name})
+ table.add_row([data_source.name, data_source.created_at, num_passages, ""])
print(table)
else:
- raise ValueError(f"Unknown option {option}")
+ raise ValueError(f"Unknown argument {arg}")
@app.command()