From 7b9ed80890abbd51bf639464190244a90c00c8be Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Wed, 8 May 2024 14:27:19 -0700 Subject: [PATCH] langchain[patch]: Dont load empty strings UnstructuredLoader (#5318) --- langchain/src/document_loaders/fs/unstructured.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/src/document_loaders/fs/unstructured.ts b/langchain/src/document_loaders/fs/unstructured.ts index 10039b6d4542..718b7e994ce8 100644 --- a/langchain/src/document_loaders/fs/unstructured.ts +++ b/langchain/src/document_loaders/fs/unstructured.ts @@ -291,7 +291,7 @@ export class UnstructuredLoader extends BaseDocumentLoader { const documents: Document[] = []; for (const element of elements) { const { metadata, text } = element; - if (typeof text === "string") { + if (typeof text === "string" && text !== "") { documents.push( new Document({ pageContent: text,