Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalDocument loadersCSVFile DirectoryHTMLJSONMarkdownPDFDocument transformersText embedding modelsVector storesRetrieversIndexingChainsMemoryAgentsCallbacksModulesSecurityGuidesMoreModulesRetrievalDocument loadersFile DirectoryOn this pageFile DirectoryThis covers how to load all documents in a directory.Under the hood, by default this uses the UnstructuredLoader.from langchain.document_loaders import DirectoryLoaderWe can use the glob parameter to control which files to load. Note that here it doesn't load the .rst file or the .html files.loader = DirectoryLoader('../', glob="**/*.md")docs = loader.load()len(docs)    1Show a progress bar‚ÄãBy default a progress bar will not be shown. To show a progress bar, install the tqdm library (e.g. pip install tqdm), and set the show_progress parameter to True.loader = DirectoryLoader('../', glob="**/*.md", show_progress=True)docs = loader.load()    Requirement already satisfied: tqdm in /Users/jon/.pyenv/versions/3.9.16/envs/microbiome-app/lib/python3.9/site-packages (4.65.0)    0it [00:00, ?it/s]Use multithreading‚ÄãBy default the loading happens in one thread. In order to utilize several threads set the use_multithreading flag to true.loader = DirectoryLoader('../', glob="**/*.md", use_multithreading=True)docs = loader.load()Change loader class‚ÄãBy default this uses the UnstructuredLoader class. However, you can change up the type of loader pretty easily.from langchain.document_loaders import TextLoaderloader = DirectoryLoader('../', glob="**/*.md", loader_cls=TextLoader)docs = loader.load()len(docs)    1If you need to load Python source code files, use the PythonLoader.from langchain.document_loaders import PythonLoaderloader =
This covers how to load all documents in a directory.
This covers how to load all documents in a directory. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalDocument loadersCSVFile DirectoryHTMLJSONMarkdownPDFDocument transformersText embedding modelsVector storesRetrieversIndexingChainsMemoryAgentsCallbacksModulesSecurityGuidesMoreModulesRetrievalDocument loadersFile DirectoryOn this pageFile DirectoryThis covers how to load all documents in a directory.Under the hood, by default this uses the UnstructuredLoader.from langchain.document_loaders import DirectoryLoaderWe can use the glob parameter to control which files to load. Note that here it doesn't load the .rst file or the .html files.loader = DirectoryLoader('../', glob="**/*.md")docs = loader.load()len(docs)    1Show a progress bar‚ÄãBy default a progress bar will not be shown. To show a progress bar, install the tqdm library (e.g. pip install tqdm), and set the show_progress parameter to True.loader = DirectoryLoader('../', glob="**/*.md", show_progress=True)docs = loader.load()    Requirement already satisfied: tqdm in /Users/jon/.pyenv/versions/3.9.16/envs/microbiome-app/lib/python3.9/site-packages (4.65.0)    0it [00:00, ?it/s]Use multithreading‚ÄãBy default the loading happens in one thread. In order to utilize several threads set the use_multithreading flag to true.loader = DirectoryLoader('../', glob="**/*.md", use_multithreading=True)docs = loader.load()Change loader class‚ÄãBy default this uses the UnstructuredLoader class. However, you can change up the type of loader pretty easily.from langchain.document_loaders import TextLoaderloader = DirectoryLoader('../', glob="**/*.md", loader_cls=TextLoader)docs = loader.load()len(docs)    1If you need to load Python source code files, use the PythonLoader.from langchain.document_loaders import PythonLoaderloader =