Building and using query engines
Our puzzle is now complete. Throughout the previous chapters, we’ve gradually learned about the key ingredients in a RAG setup. Now, it’s time to bring everything together: the nodes, indexes, retrievers, postprocessors, response synthesizers, and output parsers.
In this chapter, we’ll focus on blending these elements into a complex construct: the query engine. We’ll learn about how query engines work and the neat tricks they have up their sleeves.
Exploring different methods of building query engines
At its core, QueryEngine
is an interface that processes natural language queries to generate rich responses. It often relies on one or more indexes through retrievers and can also be combined with other query engines for enhanced capabilities.
The easiest way to define QueryEngine
is using the high-level API provided by LlamaIndex, like this:
query_engine = index.as_query_engine()
With just a single line of...