Sinhala-first offline AI chatbot for home gardening using a hybrid approach (knowledge base + local LLM via Ollama). Built with Streamlit, optimized for low-resource machines.
# 🌿 ගෙවතු වගා AI සහායක
### Sinhala Home Gardening Chatbot — Hybrid AI + Fully Offline (Ollama)
---
## 📌 Overview
A **Sinhala-first AI chatbot** designed for **home gardening (ගෙවතු වගාව)** that runs completely **offline** using a hybrid AI approach.
### 💡 Core Idea:
Instead of relying only on an LLM, this system combines:
- ⚡ **Rule-based knowledge base** → fast, accurate answers
- 🧠 **Local LLM (Ollama + Gemma)** → handles complex queries
- 🔍 **Validation layer** → ensures Sinhala-only output & quality
✅ Built for **low-resource machines (4GB RAM)**
✅ No internet required after setup
---
## 📸 Screenshots
### 🖥️ Chat Interface
### 📊 Sidebar & Quick Questions
## 🚀 Features
| Feature | Description |
|--------|------------|
| 🇱🇰 Sinhala Only | Strict Sinhala input/output |
| ⚡ Hybrid AI | Knowledge base + LLM fallback |
| 🔁 Retry Logic | Fixes bad AI outputs |
| 🧠 Validation Layer | Detects repetition & wrong language |
| 💬 Chat UI | Clean modern interface |
| 📌 Quick Prompts | Predefined questions |
| 📴 Offline Mode | Works without internet |
## ⚙️ Installation
```bash
# Clone repo
git clone
github.com
cd YOUR_REPO
# Install dependencies
pip install -r requirements.txt
# Start Ollama
ollama serve
# Run model
ollama run gemma3:1b
# Run app
streamlit run app.py
````
---
## 🧠 Core Logic
### 1. Knowledge Base Matching
* Checks Sinhala keywords (e.g., මිරිස්, තක්කාලි)
* Returns instant answers
### 2. LLM Fallback
* Uses Ollama API locally
* Sends recent chat context
### 3. Output Validation
* Ensures Sinhala language
* Detects repetition issues
### 4. Retry Mechanism
* Re-generates better responses automatically
---
## 📊 Model Options
| Model | Size | RAM | Use Case |
| ----------- | ----- | ----- | ---------------- |
| gemma3:1b ✅ | 815MB | 3–4GB | Best for low-end |
| gemma2:2b | 1.6GB | 4GB | Balanced |
| gemma3:4b | 3.3GB | 6GB+ | Higher quality |
---
## …