code: from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
  from langchain import OpenAI
  
  class GPTModel:
     def __init__(self, directory_path):
  
         # set maximum input size
        self.max_input_size = 4096
  
        # set number of output tokens
        self.num_outputs = 2000
  
        # set maximum chunk overlap
        self.max_chunk_overlap = 20
  
        # set chunk size limit
        self.chunk_size_limit = 600 
  
        self.directory_path = directory_path
  
  
     def construct_index(self): 
  
        llm_predictor = LLMPredictor(llm=OpenAI(temperature=0.5, model_name="text-davinci-003", max_tokens=self.num_outputs))
  
        prompt_helper = PromptHelper(self.max_input_size, self.num_outputs, self.max_chunk_overlap, chunk_size_limit=self.chunk_size_limit)
  
        documents = SimpleDirectoryReader(self.directory_path).load_data()
  
        index = GPTSimpleVectorIndex(
           documents, llm_predictor=llm_predictor, prompt_helper=prompt_helper
        )
  
        index.save_to_disk('gptModel.json')
apis: llama_index.PromptHelper llama_index.GPTSimpleVectorIndex llama_index.SimpleDirectoryReader
extract_api: [((673, 792), 'llama_index.PromptHelper', 'PromptHelper', (['self.max_input_size', 'self.num_outputs', 'self.max_chunk_overlap'], {'chunk_size_limit': 'self.chunk_size_limit'}), '(self.max_input_size, self.num_outputs, self.max_chunk_overlap,\n    chunk_size_limit=self.chunk_size_limit)\n', (685, 792), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor, PromptHelper\n'), ((878, 972), 'llama_index.GPTSimpleVectorIndex', 'GPTSimpleVectorIndex', (['documents'], {'llm_predictor': 'llm_predictor', 'prompt_helper': 'prompt_helper'}), '(documents, llm_predictor=llm_predictor, prompt_helper=\n    prompt_helper)\n', (898, 972), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor, PromptHelper\n'), ((565, 653), 'langchain.OpenAI', 'OpenAI', ([], {'temperature': '(0.5)', 'model_name': '"""text-davinci-003"""', 'max_tokens': 'self.num_outputs'}), "(temperature=0.5, model_name='text-davinci-003', max_tokens=self.\n    num_outputs)\n", (571, 653), False, 'from langchain import OpenAI\n'), ((808, 850), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['self.directory_path'], {}), '(self.directory_path)\n', (829, 850), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor, PromptHelper\n')]