code: #!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  import os
  import logging
  import sys
  
  from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex
  logging.basicConfig(stream=sys.stdout, level=logging.INFO)
  logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
  
  # read the document of data dir
  documents = SimpleDirectoryReader("data").load_data()
  # split the document to chunk, max token size=500, convert chunk to vector 
  
  index = GPTSimpleVectorIndex(documents)
  
  # save index
  index.save_to_disk("index.json")
apis: llama_index.GPTSimpleVectorIndex llama_index.SimpleDirectoryReader
extract_api: [((153, 211), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (172, 211), False, 'import logging\n'), ((457, 488), 'llama_index.GPTSimpleVectorIndex', 'GPTSimpleVectorIndex', (['documents'], {}), '(documents)\n', (477, 488), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex\n'), ((243, 283), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stdout'}), '(stream=sys.stdout)\n', (264, 283), False, 'import logging\n'), ((212, 231), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (229, 231), False, 'import logging\n'), ((330, 359), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""data"""'], {}), "('data')\n", (351, 359), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex\n')]