From 72cf9578f1aa31a6ebd451021677e14207cbb41f Mon Sep 17 00:00:00 2001
From: Ming <tslmy@users.noreply.github.com>
Date: Tue, 26 Dec 2023 09:00:33 -0800
Subject: [PATCH] Clarify that one needs to explicitly pass custom
 `persist_dir` to `storage_context.persist` (#9694)

---
 docs/getting_started/starter_example.md | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/docs/getting_started/starter_example.md b/docs/getting_started/starter_example.md
index 656421d1c9..ccae8c89ba 100644
--- a/docs/getting_started/starter_example.md
+++ b/docs/getting_started/starter_example.md
@@ -95,15 +95,16 @@ from llama_index import (
 )
 
 # check if storage already exists
-if not os.path.exists("./storage"):
+PERSIST_DIR = "./storage"
+if not os.path.exists(PERSIST_DIR):
     # load the documents and create the index
     documents = SimpleDirectoryReader("data").load_data()
     index = VectorStoreIndex.from_documents(documents)
     # store it for later
-    index.storage_context.persist()
+    index.storage_context.persist(persist_dir=PERSIST_DIR)
 else:
     # load the existing index
-    storage_context = StorageContext.from_defaults(persist_dir="./storage")
+    storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
     index = load_index_from_storage(storage_context)
 
 # either way we can now query the index
-- 
GitLab