New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: Summarize a long document? #13071
Comments
To achieve a comprehensive summary of your entire document split into 74 parts, you should consider using the
Regarding the difference between For implementation details and further guidance, you might want to explore the
|
Thanks @dosu. llm = Ollama(model="llama3", request_timeout=600, base_url=host, additional_kwargs=options)
query_engine_builder = QASummaryQueryEngineBuilder(llm=llm) ValueError: No API key found for OpenAI.
Please set either the OPENAI_API_KEY environment variable or openai.api_key prior to initialization.
API keys can be found or created at https://platform.openai.com/account/api-keys |
To resolve the issue where specifying
from llama_index.llms import LangChainLLM # Adjust this import to match your LLM's specific class
from llama_index import ServiceContext
# Initialize your LLM here, replacing LangChainLLM() with your Ollama initialization
llm = LangChainLLM(model="llama3", request_timeout=600, base_url=host, additional_kwargs=options)
service_context = ServiceContext(llm=llm)
from llama_index import set_global_service_context
set_global_service_context(service_context) By following these steps, you should be able to bypass the error related to the OpenAI API key and use
|
Question Validation
Question
I'm trying to summarize a long document. I've loaded a pdf document which got splitted into 74 documents by SimpleDirectoryReader.
As expected, DocumentSummaryIndex.from_documents goes through each document, and created a summary via the selected llm.
However, query_engine.query("Summarize the documents") only selects one node and sends to LLM to summarize the document.
How do you make it so that it summarizes the entire document using all nodes?
Is there a different QueryEngine or Index I should use for this purpose?
I'm sure there got to be a tutorial on this, but I couldn't find one.
The closest one I could find was Document Summary Index - LlamaIndex.
However, it's not exactly what I'm looking for. It's more of question and answer system based via embedding/llm.
Also, I'm not sure what the advantage of using DocumentSummaryIndex instead of VectorStoreIndex for Q&A.
Thanks so much for your help!
The text was updated successfully, but these errors were encountered: