Skip to content

yuripetrosyan/PolicyChatBot

Repository files navigation

Policy ChatBot 📚

Overview

This project implements an AI-powered chatbot that answers questions based on company policy documents using Retrieval-Augmented Generation (RAG). The chatbot uses a company policy PDF file as its knowledge base and provides accurate, context-aware answers that are strictly grounded in the policy content.

Unlike general-purpose AI chatbots, this system ensures all responses are based solely on the provided policy documents, making it reliable for company-specific queries. It combines modern AI technologies like OpenAI's language models with vector embeddings and semantic search to deliver relevant and accurate information.

Demo

Policy ChatBot Interface

Interactive chat interface showing a query about company policies with source citations

Key Features

Interactive Web Interface - Clean, user-friendly chat UI built with Streamlit
Source Citations - Every answer includes references to the specific policy documents
Conversation History - Maintains context throughout the chat session
Semantic Search - Uses AI embeddings to find the most relevant policy sections
Grounded Responses - Answers are based only on the policy documents, reducing hallucinations

How It Works

  1. Document Processing: Policy PDF files are loaded and split into manageable chunks
  2. Embedding Generation: Each chunk is converted into vector embeddings using OpenAI
  3. Vector Storage: Embeddings are stored in a Chroma vector database for efficient retrieval
  4. Query Processing: User questions are converted to embeddings and matched with relevant document chunks
  5. Answer Generation: The most relevant chunks are sent to GPT-5 to generate accurate, contextual answers

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file with your OpenAI API key:
OPENAI_API_KEY=your_api_key_here
  1. Add your policy PDF files to the data/ folder

Usage

Step 1: Create the Vector Database

Run this first to process your policy documents:

python create_database.py

This will:

  • Load all PDF files from the data/ folder
  • Split them into chunks
  • Create embeddings using OpenAI
  • Store them in a Chroma vector database

Step 2: Run the Web UI

Launch the chatbot interface:

streamlit run app.py

This will open a web browser with an interactive chat interface where you can ask questions about your policies.

Features

Interactive Chat Interface - Clean, modern UI for asking questions Source Citations - See which documents the answers come from Chat History - Keep track of your conversation Semantic Search - Finds relevant information using AI embeddings

Technologies Used

  • LangChain - For RAG pipeline
  • OpenAI - For embeddings and chat completion
  • Chroma - Vector database
  • Streamlit - Web UI framework

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages