diff --git a/libs/community/langchain_community/document_loaders/directory.py b/libs/community/langchain_community/document_loaders/directory.py index f181ebe95b7..b20eff88759 100644 --- a/libs/community/langchain_community/document_loaders/directory.py +++ b/libs/community/langchain_community/document_loaders/directory.py @@ -129,6 +129,7 @@ class DirectoryLoader(BaseLoader): path for path in paths if not (self.exclude and any(path.match(glob) for glob in self.exclude)) + and path.is_file() ] if self.sample_size > 0: