Query Engines and Response Synthesis
Query engines orchestrate retrieval + synthesis with strategies like refine, compact, and tree_summarize.
Query Engine = Retrieval + Synthesis
A LlamaIndex query engine has two stages:
- Retrieval — find relevant chunks
- Synthesis — generate an answer from those chunks
Both are configurable.
The Default Query Engine
query_engine = index.as_query_engine()
response = query_engine.query('What is our refund policy?')
print(response.response) # the answer
print(response.source_nodes) # the chunks usedAll lessons in this course
- Document Loaders and Parsers
- The Index Hierarchy: Vector, Tree, Keyword
- Query Engines and Response Synthesis
- Sub-Question Decomposition Strategy