Answering questions on long documents
Summarization is just the first step in achieving the goal of our users: Answering questions on long documents! No one has time to read these long documents, and while summaries are helpful, what users really want is a clear, concise answer to a question. In this section, we will discuss how you can use the long-context window of modern LLMs to efficiently answer questions on long documents.
With the introduction of Gemini 1.5 Pro, Google was able to significantly expand the context available for processing one message to the LLM. Imagine that you can perform Q&A on a 132-page long document with a single call! To easily enable you to work with long context, LangChain introduced new types of messages:
# Don't be confused by image_url when loading pdfs--this started as an image loader pdf_message = { "type": "image_url", "image_url": {"url": "...