Principle:Infiniflow Ragflow Conversation Management
| Knowledge Sources | |
|---|---|
| Domains | RAG, Conversational_AI |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
A stateful session management pattern that creates conversations, streams RAG-powered responses via SSE, and maintains message history.
Description
Conversation Management handles the runtime execution of RAG-powered chat. A Conversation entity tracks message history for a session. The async_chat function orchestrates the full RAG pipeline: retrieve relevant chunks, build a prompt with context, stream LLM responses via Server-Sent Events (SSE), and insert citation markers. Multi-turn conversations are supported by maintaining message history and using it for query rewriting.
Usage
Create a conversation after setting up a chat application. Each conversation maintains independent message history and references.
Theoretical Basis
The RAG chat pipeline follows a retrieve-then-generate pattern:
- Query rewriting: Multi-turn context is used to rewrite the current query for better retrieval
- Context injection: Retrieved chunks are formatted and injected into the LLM prompt
- Streaming: SSE enables real-time token-by-token response delivery