load_summarize_chain

  • Three ways to summarize or otherwise combine documents.
    1. Stuff : simply concatenates documents into a prompt
      • Usually the simplest method
      • When documents fit in context window
    2. Map-reduce : splits documents into batches, summarizes those, and then summarizes the summaries
      • When documents does not fit in context window
    3. Refine: updates a rolling summary be iterating over the documents in a sequence.
from langchain.chains.summarize import load_summarize_chain