code: import os
  from dotenv import load_dotenv
  from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor
  from langchain.chat_models import ChatOpenAI
  
  load_dotenv()
  
  os.environ['OPENAI_API_KEY'] = os.getenv('OPENAI_KEY')
  
  def tune_llm(input_directory="sourcedata", output_file="indexdata/index.json"):
      loaded_content = SimpleDirectoryReader(input_directory).load_data()
  
      llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0.7, model_name='gpt-3.5-turbo'))
      output_index = GPTSimpleVectorIndex(loaded_content, llm_predictor=llm_predictor)
  
      # Create the output directory if it doesn't exist
      os.makedirs(os.path.dirname(output_file), exist_ok=True)
  
      output_index.save_to_disk(output_file)
apis: llama_index.GPTSimpleVectorIndex llama_index.SimpleDirectoryReader
extract_api: [((169, 182), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (180, 182), False, 'from dotenv import load_dotenv\n'), ((215, 238), 'os.getenv', 'os.getenv', (['"""OPENAI_KEY"""'], {}), "('OPENAI_KEY')\n", (224, 238), False, 'import os\n'), ((506, 571), 'llama_index.GPTSimpleVectorIndex', 'GPTSimpleVectorIndex', (['loaded_content'], {'llm_predictor': 'llm_predictor'}), '(loaded_content, llm_predictor=llm_predictor)\n', (526, 571), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor\n'), ((643, 671), 'os.path.dirname', 'os.path.dirname', (['output_file'], {}), '(output_file)\n', (658, 671), False, 'import os\n'), ((341, 379), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['input_directory'], {}), '(input_directory)\n', (362, 379), False, 'from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor\n'), ((430, 485), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'temperature': '(0.7)', 'model_name': '"""gpt-3.5-turbo"""'}), "(temperature=0.7, model_name='gpt-3.5-turbo')\n", (440, 485), False, 'from langchain.chat_models import ChatOpenAI\n')]