This project implements a self-learning Retrieval-Augmented Generation (RAG) system that uses Chain-of-Thought (CoT) reasoning to answer questions about the Mawared HR System. The system is designed to learn from its past conversations and improve its responses over time.
The self-learning RAG system consists of the following components:
- Retriever: The retriever is responsible for retrieving relevant documents from a vector store. The vector store contains both the original documents and the conversation history.
- Generator: The generator is a large language model (LLM) that generates responses to user questions.
- Memory: The memory component stores the conversation history and provides a summarized version of the history to the generator.
- Self-Correction: The self-correction component is responsible for identifying and correcting errors in the model's responses.
The following diagram illustrates the workflow of the self-learning RAG system:
graph TD
A[User] --> B(Question);
B --> C{RAG Chain};
C --> D[Retriever];
D --> E[Vector Store];
E --> F[Original Documents];
E --> G[Conversation History];
C --> H[Generator];
H --> I{CoT Reasoning};
I --> J[Response];
J --> K{Self-Correction};
K --> L[Corrected Response];
L --> M(Memory);
M --> G;
L --> A;
- Self-Learning: The system learns from its past conversations and improves its responses over time.
- Chain-of-Thought (CoT) Reasoning: The system uses CoT reasoning to break down and solve complex questions.
- Memory: The system has a memory to remember key points from past conversations.
- Self-Correction: The system can identify and correct errors in its own responses.
To use the self-learning RAG system, you need to have Python and the required dependencies installed. You can install the dependencies using pip:
pip install -r requirements.txt
Once the dependencies are installed, you can run the Main_rag.py
script to start the system:
python Main_rag.py
The system will then prompt you to ask a question. You can type your question and press Enter to get a response. To quit the system, you can type "quit" and press Enter.