persist_dir=f"/az/indexes/{index_id}" service_context = _create_service_context() documents = SimpleDirectoryReader(input_dir=files_path).load_data() index = GPTVectorStoreIndex.from_documents(documents, service_context=service_context) index.storage_context.persist(persist_dir=persist_dir)
documents = [] for file_path in files_path: documents.extend(SimpleDirectoryReader(input_dir=file_path).load_data())
load_data
returns a List[Document] which means they should be appendable to a running list.