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.

Allow loading in a directory non-recursively (#246)

Vivian Fang6f188cffc447
diff --git a/README.md b/README.md
index 404ccbc6f..2bc71d787 100644
--- a/README.md
+++ b/README.md
@@ -119,11 +119,11 @@ MemGPT supports pre-loading data into archival memory, so your agent can referen
#### Loading Data
We currently support loading from a directory and database dumps. We highly encourage contributions for new data sources, which can be added as a new [CLI data load command](https://github.com/cpacker/MemGPT/blob/main/memgpt/cli/cli_load.py).
-Loading from a directorsy:
+Loading from a directory:
```
# loading a directory
memgpt load directory --name <NAME> \
- [--input_dir <DIRECTORY>] [--input-files <FILE1> <FILE2>...] [--recursive]
+ [--input-dir <DIRECTORY>] [--input-files <FILE1> <FILE2>...] [--recursive]
```
Loading from a database dump:
```sh
diff --git a/memgpt/cli/cli_load.py b/memgpt/cli/cli_load.py
index 9bbb112f1..a7227cd6a 100644
--- a/memgpt/cli/cli_load.py
+++ b/memgpt/cli/cli_load.py
@@ -26,9 +26,12 @@ def load_directory(
if recursive:
assert input_dir is not None, "Must provide input directory if recursive is True."
+
+ if input_dir is not None:
+ assert len(input_files) == 0, "Either load in a list of files OR a directory."
reader = SimpleDirectoryReader(
input_dir=input_dir,
- recursive=True,
+ recursive=recursive,
)
else:
reader = SimpleDirectoryReader(input_files=input_files)