Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow loading in a directory non-recursively #246

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion memgpt/cli/cli_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading