A powerful Retrieval Augmented Generation (RAG) system that enables you to chat with your documents using local LLMs through Ollama.
- 📄 PDF Processing: Upload and process PDF documents
- 💬 Interactive Chat: Streaming responses for natural conversation
- 🧠 Contextual Retrieval: RAG system pulls relevant information from your documents
- 📊 Database Management: Create, manage and search document collections
- 👤 User Authentication: Secure login system for multi-user support
- 📱 Responsive Design: Works well on desktop and mobile
- Python 3.8+
- Ollama installed and running locally (https://ollama.ai)
- Models pulled into Ollama (e.g.,
ollama pull llama3.2:latest
)
- Clone this repository:
git clone https://github.com/yourusername/RAG-Agent.git
cd RAG-Agent
- Install dependencies:
pip install -r requirements_streamlit.txt
- Start the Streamlit app:
streamlit run app_streamlit.py
-
Open your browser and navigate to: http://localhost:8501
-
Working with the Application:
- Login/Register: Create an account or login to access your document collections
- Upload Documents: Use the file uploader to add PDF documents to your collection
- Create Collections: Organize your documents into collections with descriptions
- Chat with Documents: Ask questions and get answers based on your documents
- Toggle Features: Enable/disable RAG to switch between document-based and general responses
- Change Models: Select from available Ollama models through the dropdown
The RAG-Agent system:
- Processes uploaded PDF documents, breaking them into chunks
- Creates vector embeddings of these chunks using sentence-transformers
- Stores these embeddings in a ChromaDB vector database
- On receiving a question, finds the most relevant document chunks
- Sends the relevant context along with your question to the LLM
- Returns a response grounded in your documents
app_streamlit.py
: Main Streamlit applicationrag-agent/src/
: Core RAG system componentsfileloader.py
: Document processing and embeddingollama_pure_chat.py
: Interface with Ollama APIdocument_parser.py
: Document parsing utilities
Database and storage paths are configured to use the localdatabase/
directory by default. This can be changed by setting the PERSISTENT_STORAGE_BASE
environment variable.
- Ollama Connection Issues: Ensure Ollama is running with
ollama serve
- Model Not Found: Verify you've pulled the model with
ollama pull modelname
- PDF Processing Errors: Try different PDF files or check if your PDF is searchable/OCR'd
- Database Issues: Check permissions on the
localdatabase
directory
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.