Skip to content

Self Learning RAG With COT is a project that implements Retrieval-Augmented Generation (RAG) combined with Chain of Thought (COT) reasoning. This project aims to enhance the performance of language models by enabling them to retrieve relevant information from external sources and reason through it step by step, mimicking human-like cognitive proces

Notifications You must be signed in to change notification settings

Ammar-Alnagar/SLRAG-with-COT

Repository files navigation

Self-Learning RAG System with CoT and Reasoning

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.

Architecture

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.

System Workflow

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;
Loading

Features

  • 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.

Usage

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.

About

Self Learning RAG With COT is a project that implements Retrieval-Augmented Generation (RAG) combined with Chain of Thought (COT) reasoning. This project aims to enhance the performance of language models by enabling them to retrieve relevant information from external sources and reason through it step by step, mimicking human-like cognitive proces

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages