A powerful local RAG (Retrieval Augmented Generation) application that lets you chat with your PDF documents using Ollama and LangChain. This project includes both a Jupyter notebook for experimentation and a Streamlit web interface for easy interaction.
Install Ollama
ollama pull llama2 # or your preferred model
ollama pull nomic-embed-text
Clone Repository
git clone https://github.com/tonykipkemboi/ollama_pdf_rag.git
cd ollama_pdf_rag
Set Up Environment
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
streamlit run streamlit_app.py
Then open your browser to http://localhost:8501
Streamlit interface showing PDF viewer and chat functionality
jupyter notebook
Open updated_rag_notebook.ipynb
to experiment with the code
Feel free to:
If you encounter this error:
DLL load failed while importing onnx_copy2py_export: a dynamic link Library (DLL) initialization routine failed.
Try these solutions:
Install Microsoft Visual C++ Redistributable:
If the error persists, try installing ONNX Runtime manually:
pip uninstall onnxruntime onnxruntime-gpu
pip install onnxruntime
If you're running on a CPU-only system:
Ensure you have the CPU version of ONNX Runtime:
pip uninstall onnxruntime-gpu # Remove GPU version if installed
pip install onnxruntime # Install CPU-only version
You may need to modify the chunk size in the code to prevent memory issues:
chunk_size
to 500-1000 if you experience memory problemschunk_overlap
for better context preservationNote: The application will run slower on CPU-only systems, but it will still work effectively.
This project is open source and available under the MIT License.
Built with โค๏ธ by Tony Kipkemboi