11. Conversational RAG and Memory
Resolve follow-ups, separate memory from authoritative knowledge, and reapply permissions every turn.
Resolve Follow-Up Questions
Follow-ups like “Does it apply to contractors?” need conversational context. A query rewriter can produce a standalone query while preserving the original wording. Keep a compact summary of topic, confirmed constraints, entities, and open questions rather than sending all history. If multiple interpretations remain plausible, ask for clarification.
Evaluate pronouns, topic switches, corrections, and ambiguous references separately.
Prior: Compare Basic and Pro plans.
Follow-up: What about annual billing?
Rewrite: How does annual billing work for Basic and Pro?- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
What should a rewriter do if the referent remains ambiguous?
Conversation Memory vs. Knowledge Base
Conversation memory stores turn history or user preferences; a knowledge base stores source documents. A model-generated summary is not authoritative policy. Use conversation context to resolve references, but retrieve current approved policies and live transactional facts from their systems of record.
Keep memory scoped, minimize retention, preserve provenance, and define deletion behavior for both conversation records and indexed copies.
Conversation store: topic, constraints, turn history
Knowledge index: approved documents and citations
System of record: live account / order / transaction state- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
Where should a current company policy answer come from?
Multi-Turn Permissions
Permissions can change during a conversation. Reapply authorization on every retrieval, source fetch, and cache access. A conversation ID is not proof of ownership. If a user's access is revoked, summaries or cached answers may also require redaction or invalidation. Test attempts to carry restricted facts across tenants or identities.
async function loadSource(sourceId, auth) {
return db.documents.findOne({
sourceId, tenantId:auth.tenantId, allowedUserIds:auth.userId
});
}- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
Why re-check permissions on every turn?
Evaluate Conversational Retrieval
Test follow-ups, pronouns, topic switches, corrections, multiple active documents, and earlier citations. Measure rewrite fidelity, retrieval quality, and answer quality separately. Fluent rewrites can still change intent. Do not rewrite self-contained questions unnecessarily.
{
"priorContext":"Question about Pro plan storage",
"followUp":"Does it include backups?",
"expectedQuery":"Does the Pro plan include backups?"
}- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
What should rewrite evaluation measure?