code: import logging
  import sys
  import os.path
  from llama_index.core import (
      VectorStoreIndex,
      SimpleDirectoryReader,
      StorageContext,
      load_index_from_storage,
  )
  
  logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
  logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
  
  
  # check if storage already exists
  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(persist_dir=PERSIST_DIR)
  else:
      # load the existing index
      storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
      index = load_index_from_storage(storage_context)
  
  # Either way we can now query the index
  
  query_engine = index.as_query_engine()
  response = query_engine.query("What did the author do growing up?")
  
  print("got response: ")
  print(response)
  
  
apis: llama_index.core.StorageContext.from_defaults llama_index.core.load_index_from_storage llama_index.core.VectorStoreIndex.from_documents llama_index.core.SimpleDirectoryReader
extract_api: [((173, 232), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (192, 232), False, 'import logging\n'), ((264, 304), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stdout'}), '(stream=sys.stdout)\n', (285, 304), False, 'import logging\n'), ((520, 562), 'llama_index.core.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (551, 562), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage\n'), ((705, 758), 'llama_index.core.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'persist_dir': 'PERSIST_DIR'}), '(persist_dir=PERSIST_DIR)\n', (733, 758), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage\n'), ((771, 811), 'llama_index.core.load_index_from_storage', 'load_index_from_storage', (['storage_context'], {}), '(storage_context)\n', (794, 811), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage\n'), ((233, 252), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (250, 252), False, 'import logging\n'), ((466, 495), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""data"""'], {}), "('data')\n", (487, 495), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage\n')]