Skip to content

MirazulHasan/COMPANY_POLICY_ASSISTANT_CHATBOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Company Policy Assistant: Local RAG Chatbot with Ollama

A Retrieval-Augmented Generation (RAG) chatbot designed to answer questions about company policies using uploaded PDF or TXT documents. This project demonstrates the use of LangChain, Ollama LLM & embeddings, and Chroma vector database to provide contextual answers with source citations.

🏆 Features

✅ Upload PDF or TXT files containing company policies.

✅ Semantic search with embeddings + vector database (Chroma).

✅ LLM-based answer generation using Ollama.

✅ Retrieves relevant document chunks and cites sources.

✅ Maintains conversation history within the session.

🌐 Interactive web UI built with Streamlit.

🎯 Objectives

This project is designed to showcase skills in:

  1. Document ingestion and chunking.
  2. Embedding & semantic search for relevant content.
  3. Retrieval-Augmented Generation (RAG).
  4. Session-based conversation memory.
  5. Interactive, user-friendly UI for querying documents.

🛠 Tech Stack

Component Tool / Library
LLM & Embeddings Ollama
Vector Store Chroma
Python Framework LangChain
Web Interface Streamlit
Document Loaders PyPDFLoader (PDF), TextLoader (TXT)

⚙️ Installation & Libraries

1. Install Ollama

Download here

2. Pull Models

ollama serve
ollama pull nomic-embed-text
ollama pull llama3.2

3. Clone the Repository

git clone https://github.com/MirazulHasan/COMPANY_POLICY_ASSISTANT_CHATBOT.git
cd company-policy-chatbot

4. Create a Virtual Environment

python -m venv venv

Activate the environment

Linux / macOS:

source venv/bin/activate

Windows:

venv\Scripts\activate

5. Install Required Python Libraries

You can install all dependencies using pip:

pip install -r requirements.txt

Or manually:

pip install streamlit
pip install langchain
pip install langchain_community
pip install langchain_text_splitters
pip install langchain_chroma
pip install langchain_ollama
pip install chromadb
pip install pypdf

Python 3.11+ recommended.

6. Run Ollama Locally

ollama serve

Required for embeddings and chat.

7. Start the Streamlit App

streamlit run policy_chatbot.py

Open your browser: http://localhost:8501

📝 Usage

1. Upload Policy Documents

  • Click "Upload Policy Docs" in the sidebar.

  • Accepts PDF or TXT files.

2. Ask Questions

Use the chat input to ask anything like:

What is the company’s leave policy?

How can employees request remote work?

3. View Sources

  • Answers come only from uploaded docs.

  • Click "View Sources" to see file + page + snippet.

4. Conversation History

  • Maintained within the session.

  • Each message shows in the chat interface.

🧩 Sample Policy Documents (for testing)

💡 How it Works

  1. Load Documents → Read PDFs/TXTs
  2. Split → Chunk into 1000-char segments with overlap
  3. Embed → Convert to vectors using nomic-embed-text
  4. Store → In Chroma vector DB
  5. Query → Retrieve top-4 relevant chunks
  6. Generate → LLM answers using only retrieved context
  7. Cite → Show source file + page + snippet
  8. Chat → Session memory preserved

📁 Files

  • policy_chatbot.py – Main Streamlit + RAG app
  • requirements.txt – Python dependencies

📌 Notes

  • Ensure nomic-embed-text and llama3.2 are pulled via Ollama.
  • Session memory only (in-browser). For persistence: add SQLite or JSON logging.
  • Fully local & private — no data leaves your machine.

📚 References

💻 License

© 2025 Md. Mirazul Hasan

All Rights Reserved.

For educational and internal use.

About

Local RAG chatbot for company policies. Upload PDFs/TXTs (HR, IT, remote work) and ask natural questions. Powered by Ollama (llama3.2 + nomic-embed-text), LangChain, Chroma, and Streamlit. 100% offline, no API keys, with source citations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages