This project demonstrates a simple implementation of a Retrieval-Augmented Generation (RAG) system using Python. It includes cosine similarity calculations to find the most relevant document from a corpus based on a user query and integrates with a local LLM (e.g., LLAMA2) for generating responses.
This project implements a basic RAG pipeline:
- A corpus of documents is stored.
- A user query is compared with the corpus using cosine similarity.
- The most relevant document is retrieved.
- The retrieved document and user query are passed to a local LLM for generating a response.
- Cosine Similarity: Calculates the similarity between the user query and documents in the corpus.
- Document Retrieval: Identifies the most relevant document from the corpus.
- LLM Integration: Uses a local LLM (e.g., LLAMA2) to generate responses based on the retrieved document.
- Customizable Corpus: Easily update the corpus with new documents.
- Clone the repository:
git clone https://github.com/your-username/rag-from-scratch.git cd rag-from-scratch