How does LlamaIndex ChatEngine differ from QueryEngine?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
QueryEngine is stateless retrieve and synthesize; ChatEngine adds conversation memory and can rewrite underspecified follow-ups into standalone queries before retrieval.
Picture a research assistant at a library. The QueryEngine version is the desk attendant. You walk up, ask one question, they pull a book, read you the relevant page, you leave. Every visit starts fresh; they do not remember you. The ChatEngine version is a personal researcher you book by the hour. They remember what you asked last time. When you say 'and what about its side effects?', they know 'its' means the drug you discussed three minutes ago, and they rewrite the question into something they can actually search before pulling the next book. The difference is memory and follow-up rewriting, not the books or the search.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: QueryEngine vs ChatEngine, the three ChatEngine modes, the antecedent-resolution failure mode, and how to pick a mode.
| Axis | QueryEngine | ChatEngine |
|---|---|---|
| State | Stateless per call | Conversation memory across turns |
| Turn handling | Literal query → retrieve → synthesize | Mode-dependent (condense / context / react) |
| Follow-up rewriting | No | Yes in condense_question mode |
| Tool-calling option | No (just retrieve) | Yes in react mode |
| Cost per turn | 1 retrieval + 1 synthesis | Up to 1 rewrite + 1 retrieval + 1 synthesis |
| Best fit | Search box, single-turn Q&A | Multi-turn chatbot with referential follow-ups |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Using QueryEngine for a chatbot and discovering that follow-up questions like 'and what about its side effects?' retrieve garbage because the pronoun gets embedded with no antecedent.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.