An open API service indexing awesome lists of open source software.

https://github.com/yahya-py/ollama-llm-rag-chatbot

Local AI chatbot using LLaMA3 + personal data with LangChain, Chroma & Gradio UI
https://github.com/yahya-py/ollama-llm-rag-chatbot

chatbot gradio langchain llama3 local localllm python

Last synced: 3 months ago
JSON representation

Local AI chatbot using LLaMA3 + personal data with LangChain, Chroma & Gradio UI

Awesome Lists containing this project

README

          

# 🤖 Smart AI Chatbot with Local LLM + Personal Data

This project is a lightweight, fully functional AI chatbot built with **Gradio**, **LangChain**, and **Ollama**. It supports both general-purpose chatting using local LLMs (like `llama3.2`) and personalized answers based on your own uploaded documents — all without relying on cloud APIs like OpenAI or Cohere.

Smart AI Chatbot built on LLaMA3 using LangChain, ChromaDB, and Gradio. Supports real-time chat with optional retrieval-augmented responses from your own documents. 100% offline and privacy-first — perfect for developers, researchers, and businesses

---

## 🔍 Features

- 🧠 **Local LLM** (e.g. `llama3.2`) powered via [Ollama](https://ollama.com/)
- 📚 **Document-aware Q&A** using `langchain` + `Chroma` vector DB
- 💬 **Gradio Interface** with full chat history
- 🖼️ Custom branding with logo and responsive UI
- ✅ Toggle between general chatbot and personal knowledge base
- 🔒 Runs 100% offline — fully private and secure

---

## 📸 Preview

![chatbot interface](./image.png)

---

## 🚀 How It Works

| Mode | Description |
|------|-------------|
| **General Mode** | Chatbot answers general questions using your chosen local LLM |
| **Personal Data Mode** | It retrieves relevant info from your uploaded `.txt` files before generating a response |

---

## 🛠️ Installation

### 1. Clone this repository

```bash
git clone https://github.com/Yahya-py/OLLAMA-LLM-RAG-Chatbot.git
cd OLLAMA-LLM-RAG-Chatbot
```

### 2. Install requirements

```bash
pip install -r requirements.txt
```

### 3. Install and Run Ollama

```bash
ollama pull llama3.2
ollama run llama3.2
```

---

## 📁 Directory Structure

```
OLLAMA-LLM-RAG-Chatbot/
├── chatbot_ollama_rag_llama32.py # Main Python script
├── image.png # Logo for chatbot UI
├── data/ # Folder containing user documents (.txt)
├── chroma_db/ # Persisted vector DB (auto-generated)
└── requirements.txt
```

---

## ⚙️ Usage

```bash
python chatbot_ollama_rag_llama32.py
```

Visit [http://127.0.0.1:7860](http://127.0.0.1:7860) in your browser.

You can:
- Type your question
- Check "Use Personal Documents?" to answer from your documents
- View full chat history in real-time

---

## 🧠 Customize

- Replace `image.png` with your own brand logo
- Add `.pdf`, `.docx`, or `.md` support using `langchain` loaders
- Train or fine-tune your own model using [Ollama fine-tune](https://ollama.com/blog/fine-tune-your-own-model)

---

## 🔐 Privacy Note

This project **does not send any data to the cloud**. All inference and document processing are done locally.

---

## 🏷️ Tags

```
python, chatbot, langchain, gradio, ollama, llama3, chromadb, local-llm, document-chatbot, AI-portfolio
```

---

## 📃 License

MIT License — free to use, modify, and share.