Above just a part code, user upload their document to our system, we will create the DocumentSummaryIndex and persist it. I found the llamaindex will stored chunk text and summary result on local docstore.json file.
Q1: Each chunk text will send to LLM get summary, use the default prompt: Is parallel to call LLM API do chunk summarize?
Context information from multiple sources is below.
---------------------
{text}
---------------------
Given the information from multiple sources and not prior knowledge, answer the query.
Query: Describe what the provided text is about. Also describe some of the questions that this text can answer.
Answer:
Q2: Why need LLM "describe some of the questions that this text can answer", What role do these questions play?
Q3: When use the DocumentSummaryIndex create the query engine to answer user query, I see query engine not used local docstore.json file summary result, just call LLM API to do each chunk summarize and combine those summary do final summarize.
What role do these summary result play on stage of create summary index?
doc_summary_index = load_index_from_storage(
StorageContext.from_defaults(
persist_dir=store_path
),
service_context=service_context,
)
summary_query_engine = doc_summary_index.as_query_engine(
response_mode="tree_summarize",
streaming=True,
use_async=True
)
query = 'write a summary about this document'
summary_query_engine.query(query)