# Part 1: Submit batch during pipeline - remember a documentcontextextractor can literally take # hours to run - or days in the extreme case. batch processing can cut costs by 50%! extractor = DocumentContextExtractor( docstore=docstore, llm=llm, mode="submit_batch" ) # Must be last transform in pipeline index.update_nodes(transforms=[transform_A, transform_B, transform_C, extractor]) index.persist(...) # Part 2: Check batch status and update nodes # first load index index = ... extractor.set_mode("process_batch") while not extractor.is_batch_complete(): num_completed = index.update_nodes(transforms=[extractor]) # Maybe return number of nodes updated for user feedback time.sleep(...) # User controls polling frequency # After this, user can do whatever they want with their context-enabled nodes