code: import os 
  import pickle 
  from dotenv import load_dotenv
  
  import llama_index
  from langchain import OpenAI
  from langchain.embeddings import OpenAIEmbeddings
  from llama_index import LLMPredictor, ServiceContext
  from llama_index import SimpleDirectoryReader, LangchainEmbedding, GPTVectorStoreIndex
  
  class IndexChatBot:
      def __init__(self, project_name : str, artifact_folder : str) -> None:
          self.story_summary_path = os.path.join(artifact_folder, project_name, "story_summary.pkl")
          self.story_summary = pickle.load(
              open(self.story_summary_path, "rb")
          )
          chunks = self.story_summary['summary_chunks']
          self.documents = [llama_index.Document(t) for t in chunks]
  
          load_dotenv(dotenv_path='.env/openai.env')
          try:
              _openai_key = os.getenv("OPENAI_API_KEY")
              self.llm_predictor = LLMPredictor(
                  llm = OpenAI(openai_api_key=_openai_key, temperature=0),
              )
              openai_embedding = OpenAIEmbeddings(openai_api_key=_openai_key)
              self.embed_model = LangchainEmbedding(openai_embedding)
  
              self.service_context = ServiceContext.from_defaults(
                  llm_predictor=self.llm_predictor,embed_model=self.embed_model
              )
  
              self.vector_store_index = GPTVectorStoreIndex.from_documents(
                  self.documents, service_context=self.service_context
              )
          except Exception as e:
              print(f"Certain exception occured as {e}")
          
          self.query_engine = self.vector_store_index.as_query_engine()
          print("=> Everything loaded successfully")
      
      def get_response(self, query : str) -> str:
          return str(self.query_engine.query(query))
apis: llama_index.GPTVectorStoreIndex.from_documents llama_index.ServiceContext.from_defaults llama_index.Document llama_index.LangchainEmbedding
extract_api: [((426, 490), 'os.path.join', 'os.path.join', (['artifact_folder', 'project_name', '"""story_summary.pkl"""'], {}), "(artifact_folder, project_name, 'story_summary.pkl')\n", (438, 490), False, 'import os\n'), ((721, 763), 'dotenv.load_dotenv', 'load_dotenv', ([], {'dotenv_path': '""".env/openai.env"""'}), "(dotenv_path='.env/openai.env')\n", (732, 763), False, 'from dotenv import load_dotenv\n'), ((671, 694), 'llama_index.Document', 'llama_index.Document', (['t'], {}), '(t)\n', (691, 694), False, 'import llama_index\n'), ((803, 830), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (812, 830), False, 'import os\n'), ((996, 1040), 'langchain.embeddings.OpenAIEmbeddings', 'OpenAIEmbeddings', ([], {'openai_api_key': '_openai_key'}), '(openai_api_key=_openai_key)\n', (1012, 1040), False, 'from langchain.embeddings import OpenAIEmbeddings\n'), ((1072, 1108), 'llama_index.LangchainEmbedding', 'LangchainEmbedding', (['openai_embedding'], {}), '(openai_embedding)\n', (1090, 1108), False, 'from llama_index import SimpleDirectoryReader, LangchainEmbedding, GPTVectorStoreIndex\n'), ((1145, 1242), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm_predictor': 'self.llm_predictor', 'embed_model': 'self.embed_model'}), '(llm_predictor=self.llm_predictor, embed_model=\n    self.embed_model)\n', (1173, 1242), False, 'from llama_index import LLMPredictor, ServiceContext\n'), ((1306, 1399), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['self.documents'], {'service_context': 'self.service_context'}), '(self.documents, service_context=self.\n    service_context)\n', (1340, 1399), False, 'from llama_index import SimpleDirectoryReader, LangchainEmbedding, GPTVectorStoreIndex\n'), ((900, 949), 'langchain.OpenAI', 'OpenAI', ([], {'openai_api_key': '_openai_key', 'temperature': '(0)'}), '(openai_api_key=_openai_key, temperature=0)\n', (906, 949), False, 'from langchain import OpenAI\n')]