diff --git a/docs/getting_started/starter_example.md b/docs/getting_started/starter_example.md index 656421d1c987419c2d107de68f3925e7ffcbe394..ccae8c89ba148c6957d7962474c6d4ad8b8e7708 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