A local RAG (Retrieval-Augmented Generation) agent powered by DeepSeek Coder, Ollama, and Sentence Transformers embeddings.
- 🤖 Powered by DeepSeek Coder 7B via Ollama
- 🔍 Sentence Transformers (
all-MiniLM-L6-v2) for semantic search - 💾 ChromaDB for fast vector storage
- 🎯 User-friendly Streamlit interface
- 📚 Robust document upload and processing (handles encoding issues)
- 💬 Interactive chat interface
- Install Ollama
- Python 3.8 or higher
- Clone this repository:
git clone <repository-url>
cd <repository-name>- Create a virtual environment and activate it:
python -m venv venv # or: python -m venv .venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install the required packages:
pip install -r requirements.txt- Pull the required models:
ollama pull deepseek-coder:7b- Start the Streamlit application:
streamlit run app.py-
Open your web browser and navigate to the URL shown in the terminal (usually http://localhost:8501)
-
Upload documents to build your knowledge base:
- Click the "Upload a document" button
- Select a text file (.txt), PDF (.pdf), or Markdown (.md) file
- The app robustly handles encoding issues, so problematic files will not crash the app
- Wait for the document to be processed
-
Start chatting with the RAG agent:
- Type your questions in the chat input
- The agent will use the uploaded documents to provide relevant answers
- Document Upload: Upload your knowledge files (txt, pdf, md). The app reads and splits them into chunks, handling encoding issues gracefully.
- Embedding: Each chunk is embedded using Sentence Transformers (
all-MiniLM-L6-v2). - Vector Storage: Embeddings are stored in ChromaDB for fast similarity search.
- Retrieval: When you ask a question, relevant chunks are retrieved from the vector store.
- LLM Response: The DeepSeek Coder 7B model (via Ollama) generates an answer using the retrieved context.
- The
venv/directory,.venv/, and large model files are not tracked by git (see.gitignore). - You must pull models locally using Ollama (
ollama pull deepseek-coder:7b). - If you encounter errors about large files when pushing to GitHub, see the Troubleshooting section below.
- Large file push errors:
- If you see errors about files over 100MB, it means a large file was committed to git history.
- Remove it from history using
git filter-repo(see below) and force-push:git filter-repo --path <path-to-large-file> --invert-paths --force git remote add origin <your-repo-url> # if needed git push --force origin main
- Model not found:
- Run
ollama pull deepseek-coder:7bto download the required model locally.
- Run
- Encoding errors on upload:
- The app uses robust decoding (
errors='replace') so problematic files will not crash the app. If you see garbled text, check your file’s encoding.
- The app uses robust decoding (
Make sure your requirements.txt includes:
- streamlit
- langchain
- chromadb
- sentence-transformers
- (and any other dependencies your code uses)
Feel free to open an issue or PR if you need help or want to contribute!
-
Document Processing:
- Documents are split into chunks
- Chunks are converted into embeddings using NOMIC
- Embeddings are stored in ChromaDB
-
Question Answering:
- User questions are converted into embeddings
- Similar chunks are retrieved from the vector store
- The DeepSeek model generates answers based on the retrieved context
- The application runs completely locally
- No API keys or external services are required
- All data is stored in the
./chroma_dbdirectory
MIT License
