code: #ingest uploaded documents
  from global_settings import STORAGE_PATH, INDEX_STORAGE, CACHE_FILE
  from logging_functions import log_action
  from llama_index.core import SimpleDirectoryReader, VectorStoreIndex
  from llama_index.core.ingestion import IngestionPipeline, IngestionCache
  from llama_index.core.node_parser import TokenTextSplitter
  from llama_index.core.extractors import SummaryExtractor
  from llama_index.embeddings.openai import OpenAIEmbedding
  
  def ingest_documents():
      documents = SimpleDirectoryReader(
          STORAGE_PATH, 
          filename_as_id = True
      ).load_data()
      for doc in documents:
          print(doc.id_)
          log_action(
              f"File '{doc.id_}' uploaded user", 
              action_type="UPLOAD"
          )
      
      try: 
          cached_hashes = IngestionCache.from_persist_path(
              CACHE_FILE
              )
          print("Cache file found. Running using cache...")
      except:
          cached_hashes = ""
          print("No cache file found. Running without cache...")
      pipeline = IngestionPipeline(
          transformations=[
              TokenTextSplitter(
                  chunk_size=1024, 
                  chunk_overlap=20
              ),
              SummaryExtractor(summaries=['self']),
              OpenAIEmbedding()
          ],
          cache=cached_hashes
      )
     
      nodes = pipeline.run(documents=documents)
      pipeline.cache.persist(CACHE_FILE)
      
      return nodes
  
  if __name__ == "__main__":
      embedded_nodes = ingest_documents()
apis: llama_index.core.extractors.SummaryExtractor llama_index.core.ingestion.IngestionCache.from_persist_path llama_index.core.SimpleDirectoryReader llama_index.core.node_parser.TokenTextSplitter llama_index.embeddings.openai.OpenAIEmbedding
extract_api: [((644, 711), 'logging_functions.log_action', 'log_action', (['f"""File \'{doc.id_}\' uploaded user"""'], {'action_type': '"""UPLOAD"""'}), '(f"File \'{doc.id_}\' uploaded user", action_type=\'UPLOAD\')\n', (654, 711), False, 'from logging_functions import log_action\n'), ((786, 830), 'llama_index.core.ingestion.IngestionCache.from_persist_path', 'IngestionCache.from_persist_path', (['CACHE_FILE'], {}), '(CACHE_FILE)\n', (818, 830), False, 'from llama_index.core.ingestion import IngestionPipeline, IngestionCache\n'), ((493, 549), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['STORAGE_PATH'], {'filename_as_id': '(True)'}), '(STORAGE_PATH, filename_as_id=True)\n', (514, 549), False, 'from llama_index.core import SimpleDirectoryReader, VectorStoreIndex\n'), ((1089, 1141), 'llama_index.core.node_parser.TokenTextSplitter', 'TokenTextSplitter', ([], {'chunk_size': '(1024)', 'chunk_overlap': '(20)'}), '(chunk_size=1024, chunk_overlap=20)\n', (1106, 1141), False, 'from llama_index.core.node_parser import TokenTextSplitter\n'), ((1202, 1238), 'llama_index.core.extractors.SummaryExtractor', 'SummaryExtractor', ([], {'summaries': "['self']"}), "(summaries=['self'])\n", (1218, 1238), False, 'from llama_index.core.extractors import SummaryExtractor\n'), ((1252, 1269), 'llama_index.embeddings.openai.OpenAIEmbedding', 'OpenAIEmbedding', ([], {}), '()\n', (1267, 1269), False, 'from llama_index.embeddings.openai import OpenAIEmbedding\n')]