# RAG System

This is an end-to-end retrieval-augmented generation system for Chinese recipe question answering, covering data cleaning, hybrid retrieval, multi-turn conversation state and structured answer generation, verified with real end-to-end tests against a live model rather than mocks.

The system decomposes each incoming request into safety checks, understanding of the current conversational turn, reference resolution for phrases such as "the first one" or "that dish", an execution plan, retrieval, evidence-quality judgment, context packing, answer generation and a final state update, rather than handling retrieval and generation in one function. Retrieval combines vector search with BM25 and reciprocal rank fusion, with fallback behaviour and low-evidence protection, and a FAISS index backs the vector side.

Answer generation prefers controlled templates for well-defined content such as ingredients and steps over free-form generation, and a streaming Flask API serves both a JSON and a server-sent-events interface.

The project reports results from an eighty-five-turn live end-to-end evaluation against a real hosted model rather than a mocked one, and is written in Python.

Website: https://github.com/fengyede79/rag-system
