code: import os
  from llama_index import StorageContext, load_index_from_storage
  from dotenv import load_dotenv
  from llama_index import VectorStoreIndex, SimpleDirectoryReader
  
  load_dotenv()
  
  
  os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
  LIBRARY_DIRECTORY = os.getenv('LIBRARY_DIRECTORY')
  
  
  documents = SimpleDirectoryReader(LIBRARY_DIRECTORY).load_data()
  index = VectorStoreIndex.from_documents(documents)
  
  index.storage_context.persist()
  
  # rebuild storage context
  # storage_context = StorageContext.from_defaults(persist_dir="./storage")
  # load index
  # index = load_index_from_storage(storage_context)
  
  # query_engine = index.as_query_engine()
  # query_engine.query("YOUR_QUESTION")
  
apis: llama_index.VectorStoreIndex.from_documents llama_index.SimpleDirectoryReader
extract_api: [((170, 183), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (181, 183), False, 'from dotenv import load_dotenv\n'), ((217, 244), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (226, 244), False, 'import os\n'), ((265, 295), 'os.getenv', 'os.getenv', (['"""LIBRARY_DIRECTORY"""'], {}), "('LIBRARY_DIRECTORY')\n", (274, 295), False, 'import os\n'), ((371, 413), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (402, 413), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader\n'), ((310, 350), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['LIBRARY_DIRECTORY'], {}), '(LIBRARY_DIRECTORY)\n', (331, 350), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader\n')]