From 06c41d34f09ee2b6e5ae6cf3fe28d7a1e9517f12 Mon Sep 17 00:00:00 2001
From: Ravi Theja <ravi03071991@gmail.com>
Date: Fri, 9 Feb 2024 21:27:29 +0530
Subject: [PATCH] Update Ingestion Pipeline to handle empty documents (#10543)

---
 llama_index/ingestion/pipeline.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llama_index/ingestion/pipeline.py b/llama_index/ingestion/pipeline.py
index fee44d6b20..cb0b0d992b 100644
--- a/llama_index/ingestion/pipeline.py
+++ b/llama_index/ingestion/pipeline.py
@@ -461,7 +461,7 @@ class IngestionPipeline(BaseModel):
                         repeat(cache_collection),
                     ),
                 )
-                nodes = reduce(lambda x, y: x + y, nodes_parallel)
+                nodes = reduce(lambda x, y: x + y, nodes_parallel, [])
         else:
             nodes = run_transformations(
                 nodes_to_run,
@@ -623,7 +623,7 @@ class IngestionPipeline(BaseModel):
                     for batch in node_batches
                 ]
                 result: List[List[BaseNode]] = await asyncio.gather(*tasks)
-                nodes = reduce(lambda x, y: x + y, result)
+                nodes = reduce(lambda x, y: x + y, result, [])
         else:
             nodes = await arun_transformations(
                 nodes_to_run,
-- 
GitLab