RAGify is an intelligent retrieval-augmented chat application that lets users upload documents, ask questions about their content, and manage a personal knowledge base with persistent conversation history.
This project implements the RAG (Retrieval-Augmented Generation) pattern to create a chatbot that answers questions based on a set of documents provided by the user. The application is fully interactive, with a web interface built in Streamlit, and includes a robust backend to manage users, conversations, and each user's vector indexes.
The diagram below illustrates the flow of the application, from user login to document upload, processing, and interaction with the chat.
| Application Flow |
|---|
- User Authentication: Account Sign Up/Login system to ensure that each user’s data is private and persistent.
- Multi-format Upload: Supports uploading
.pdf,.docx,.xlsx,.csv,.txt, and.mdfiles. - User Data Persistence:
- Chat History: Conversations are saved in a SQLite database and reloaded on each login.
- Knowledge Base: Uploaded documents are converted into vectors and stored in a dedicated FAISS index for each user.
- File Management: Users can view and delete previously uploaded files, with the knowledge base updated accordingly.
- Streamlit
- Python 3.12+
- LLM and RAG: Ollama with the
llama3model and LangChain. - Relational Database: SQLite
- Vector Database: Facebook AI Similarity Search (FAISS)
- Embeddings Model:
nomic-ai/nomic-embed-text-v1from Hugging Face
Follow the steps below to set up and run the project locally.
- Python 3.12 or higher: Download Python
- Git: To clone the repository.
- Ollama: The application uses Ollama to run the Llama 3 model locally.
- Install Ollama.
- After installation, pull the
llama3model with:ollama pull llama3
- Make sure Ollama is running before starting the Streamlit app.
git clone https://github.com/PLeonLopes/RAGify.git
cd RAGify# Create the virtual environment
python3 -m venv venv
# Activate the virtual environment
venv\Scripts\activate # <- Windows
source venv/bin/activate # <- macOS/LinuxNow install all dependencies with:
pip install -r requirements.txtWith the virtual environment activated, run Ollama and start the Streamlit app:
ollama servestreamlit run src/app.pyThe application should automatically open in your default browser.
-
Create an Account: In the sidebar, enter a username and password and click "Create Account".
-
Login: Use the same credentials to log in.
-
Upload Files: In the sidebar, select one or more documents and click the "Process Files" button.
-
Wait for Processing: The application will extract the text, generate embeddings, and save your knowledge base.
-
Chat: Once the files are processed, go to the main chat area, type your question, and click "Send".
-
Manage Your Files: In the sidebar, you can view the list of uploaded files and remove any of them by clicking the trash icon.