0PricingLogin
AI Agents · Lesson

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:

  1. Retrieval — find relevant chunks
  2. 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 used

All lessons in this course

  1. Document Loaders and Parsers
  2. The Index Hierarchy: Vector, Tree, Keyword
  3. Query Engines and Response Synthesis
  4. Sub-Question Decomposition Strategy
← Back to AI Agents