Although Large Language Models (LLMs) are powerful and capable of generating creative content, they can produce outdated or incorrect information as they are trained on static data. To overcome this limitation, Retrieval Augmented Generation (RAG) systems can be used to connect the LLM to external data and obtain more reliable answers.
The aim of this project is to build a RAG chatbot in Langchain powered by OpenAI. You can upload documents in txt or pdf formats and chat with your data. Relevant documents will be retrieved and sent to the LLM along with your follow-up questions for accurate answers.
(Example architecture of a RAG model)
This project requires Python 3 and the langchain packages: langchain
and langchain-openai
.
To run the app locally:
- Create a virtual environment:
python -m venv my_first_rag_chatbot
- Activate the virtual environment :
source my_first_rag_chatbot\bin\activate
- Install the required dependencies:
pip install langchain langchain-openai
- Input your data in the ./data directory: Currently, the supported formats are txt, pdf, or docx files.
- Step into our directory:
cd RAG_Chatbot
- Run the app:
python RAG_chatbot.py