# Load documents documents = SimpleDirectoryReader('data').load_data() # Build the GPTVectorStoreIndex index = GPTVectorStoreIndex.from_documents(documents, service_context=service_context)
index.storage_context.persist(persist_dir="./storage") from llama_index import load_index_from_storage, ServiceContext storage_context = StorageContext.from_defaults(persist_dir="./storage") index = load_index_from_storage(storage_context, service_context=service_context)