From 42eb73a08fdde2fc23320f34a91d244ddd861cc1 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Wed, 26 Jun 2024 09:30:58 +0200
Subject: [PATCH] fix: IngestionPipeline not working without vectorStores
 (#976)

---
 .changeset/polite-kids-approve.md                      |  5 +++++
 packages/llamaindex/src/ingestion/IngestionPipeline.ts | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 .changeset/polite-kids-approve.md

diff --git a/.changeset/polite-kids-approve.md b/.changeset/polite-kids-approve.md
new file mode 100644
index 000000000..34a94986d
--- /dev/null
+++ b/.changeset/polite-kids-approve.md
@@ -0,0 +1,5 @@
+---
+"llamaindex": patch
+---
+
+Fix IngestionPipeline not working without vectorStores
diff --git a/packages/llamaindex/src/ingestion/IngestionPipeline.ts b/packages/llamaindex/src/ingestion/IngestionPipeline.ts
index b133377b3..2b2a5e54d 100644
--- a/packages/llamaindex/src/ingestion/IngestionPipeline.ts
+++ b/packages/llamaindex/src/ingestion/IngestionPipeline.ts
@@ -77,13 +77,15 @@ export class IngestionPipeline {
     if (!this.docStore) {
       this.docStoreStrategy = DocStoreStrategy.NONE;
     }
-    this.vectorStores = this.vectorStores ?? {
-      [ModalityType.TEXT]: this.vectorStore,
-    };
+    this.vectorStores =
+      this.vectorStores ??
+      (this.vectorStore
+        ? { [ModalityType.TEXT]: this.vectorStore }
+        : undefined);
     this._docStoreStrategy = createDocStoreStrategy(
       this.docStoreStrategy,
       this.docStore,
-      Object.values(this.vectorStores),
+      this.vectorStores ? Object.values(this.vectorStores) : undefined,
     );
     if (!this.disableCache) {
       this.cache = new IngestionCache();
-- 
GitLab