Two Retrieval-Augmented Generation (RAG) pipelines that run entirely locally via Ollama — no cloud APIs required. Built as the final project for a Natural Language Processing course.
A from-scratch implementation with no RAG framework — manual cosine similarity, in-memory vector database, and direct Ollama API calls. Good for understanding how RAG works at the component level.
- Processes
panda-facts.txtline-by-line as chunks - Custom cosine similarity retrieval
- Streamed response output
Run:
ollama pull hf.co/CompendiumLabs/bge-base-en-v1.5-gguf
ollama pull hf.co/bartowski/Llama-3.2-1B-Instruct-GGUF
python simple_rag.pyA production-oriented pipeline built on LangChain. Ingests PDF, DOCX, TXT and Markdown documents, splits them into chunks, embeds them with HuggingFace models, and indexes them in a persistent FAISS vector store.
- Multi-format document loading (PDF, DOCX, TXT, Markdown)
- Recursive character chunking
- FAISS persistent vector store (Chroma supported but experimental)
- Configurable via a central
configdict at the top of the file - HuggingFace embeddings + Ollama or HuggingFace inference
Run:
pip install -r requirements.txt
# Place PDF/DOCX/TXT files in inputs/
python lib_rag.pySample animal care documents from Wild Welfare are included in inputs/.
├── simple_rag.py # From-scratch RAG implementation
├── panda-facts.txt # Sample dataset for simple_rag
├── lib_rag.py # LangChain-based pipeline
├── requirements.txt # Dependencies for lib_rag
├── inputs/ # Sample PDFs for lib_rag
├── demo/ # Standalone demo using llama.cpp directly
├── docs/ # Report and final presentation
└── docs/concepts.md # RAG glossary and reference links
- Python 3.10+
- Ollama installed and running locally