Zack Saadioui
8/24/2024
1
TextLoader
1
pip install langchain
1 2 3 4 5 6 7
from langchain_community.document_loaders import DirectoryLoader # Initialize the loader loader = DirectoryLoader('/path/to/your/directory', glob='**/*.md') # Load documents docs = loader.load() print(f'Loaded {len(docs)} documents')
1
load
1
docs
1 2 3 4
from langchain_community.document_loaders import TextLoader loader = DirectoryLoader('/path/to/your/directory', glob='**/*.txt', loader_cls=TextLoader) docs = loader.load()
1
2
python
loader = DirectoryLoader('../', glob='**/*.pdf')
1
tqdm
1
2
3
python
loader = DirectoryLoader('../', glob='**/*.pdf', show_progress=True)
docs = loader.load()
1
2
3
python
loader = DirectoryLoader('../', glob='**/*.csv', use_multithreading=True)
docs = loader.load()
1
2
3
python
loader = DirectoryLoader('../', glob='**/*.txt', silent_errors=True)
docs = loader.load()
1
DirectoryLoader
1
.csv
Copyright © Arsturn 2024