Skip to content

A fully local RAG agent that parses PDFs and enables contextual Q&A using LLaMA 3.2 via Ollama, ChromaDB, and Gradio — no internet or API keys required, with faster response time.

Notifications You must be signed in to change notification settings

Aadeshh0/local-rag-agent

Repository files navigation

📄 Local RAG Agent

A local Retrieval-Augmented Generation (RAG) system that accepts CSV, processes the content, and enables contextual question answering using LLaMA 3.2 via Ollama, Ollama Embeddings, and ChromaDB, all through an interactive Gradio interface.


🚀 Features

  • 🔍 Contextual Q&A: Ask questions about the document and get accurate, grounded responses from the local LLM.
  • 💡 Fully Local Pipeline: No internet or API calls required—runs entirely offline using Ollama and ChromaDB.
  • Fast Retrieval: Vector similarity search ensures fast and relevant document chunk matching.
  • 🖥️ Interactive UI: Clean Gradio interface for uploading files and querying them in real-time.

🛠 Tech Stack

  • Language Model: LLaMA 3.2 via Ollama
  • Embeddings: Ollama Embeddings
  • Vector Store: ChromaDB
  • Frontend: Gradio
  • Programming Language: Python

🧠 Architecture Overview

CSV Upload → Text Extraction & Chunking → Ollama Embeddings (Vectorization) → ChromaDB (Vector Store for Retrieval) → User Query → Relevant Chunks Retrieved → LLaMA 3.2 (Local LLM Inference) → Answer (Context-Aware Response)


📦 Installation

  1. Clone the repository
git clone https://github.com/your-username/local-pdf-rag-agent.git
cd local-pdf-rag-agent
  1. Install Dependencies
pip install -r requirements.txt
  1. Start Ollama and download the model

First you need to download Ollama from their official website. Now open your terminal or command prompt

ollama run llama3.2

Before running the project make sure Ollama is running in the background.

To run the project, from the root directory :

uv run python src/main.py           # for running on terminal
uv run python src/gradio_app.py     # for running the gradio app 

🛠 Troubleshooting: Environment Setup Issues

If you encounter the following warning:

Warning

Mismatched Virtual Environment

This typically means the current Python environment doesn't match the expected .venv.

✅ Fix Options:

  1. Create a fresh virtual environment with uv (recommended)
uv venv .venv
uv pip install -r requirements.txt

Then run the app with

uv run python src/main.py

or

uv run --active python src/main.py

🧪 Example Use Cases

  1. Upload a research paper and ask for summaries or definitions.

  2. Upload a policy document and ask for specific clauses.

  3. Upload a user manual and ask how a feature works.

  4. Upload financial statements and ask key insights.

About

A fully local RAG agent that parses PDFs and enables contextual Q&A using LLaMA 3.2 via Ollama, ChromaDB, and Gradio — no internet or API keys required, with faster response time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages