🚀 Live Demo: HR Policy Assistant
🌐 Deployment Platform: Render
A lightweight Retrieval-Augmented Generation (RAG) application for answering employee questions from an internal HR policy document. The project combines a local policy corpus, embeddings, semantic retrieval, and an LLM-powered agent to provide grounded answers instead of relying on memory alone.
Organizations often store policies in long documents such as employee handbooks, onboarding guides, and internal policy PDFs. Searching these documents manually is time-consuming and error-prone. This project demonstrates how to build a simple but effective HR assistant that:
- reads and splits a policy document into searchable chunks
- converts chunks into vector embeddings
- retrieves the most relevant policy passages
- uses a language model to answer based only on retrieved evidence
- exposes the assistant through a CLI or a Streamlit web app
- HR policy Q&A using RAG
- FAISS vector search for fast retrieval
- Jina embeddings for semantic matching
- Groq-hosted LLM support
- LangChain agent workflow with tool-based retrieval
- Streamlit UI for interactive conversations
- Persistent FAISS index to avoid reindexing on every run
- Easy setup using environment variables and a Python virtual environment
- Python 3.11
- LangChain and LangChain Community
- Groq LLM provider
- Jina Embeddings
- FAISS for vector storage and retrieval
- Streamlit for the web interface
- Python-dotenv for environment configuration
- FAISS local index stored in the project data directory
The project follows a standard RAG pattern:
-
Document ingestion
- The HR policy text file is loaded from the data folder.
-
Chunking
- The document is divided into smaller text chunks with overlap to retain nearby context.
-
Embedding generation
- Each chunk is converted into vectors using Jina embeddings.
-
Vector storage
- The embeddings are stored in a FAISS index for fast similarity search.
-
Retrieval
- A retriever fetches the top matching chunks for the user question.
-
Agent reasoning
- A LangChain agent passes the retrieved context to an LLM and answers using the search results as evidence.
-
User interface
- The assistant can be used through the terminal demo or a Streamlit chat app.
A simple view of the flow looks like this:
HR policy text file
↓
Document loader
↓
Text splitter
↓
Embedding model
↓
FAISS vector store
↓
Retriever
↓
LangChain agent + LLM
↓
Answer to the user
HR-POLICY-ASSISTANT/
├── app.py # Streamlit web app
├── main.py # CLI demo entry point
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── LICENSE # MIT license
├── data/
│ ├── hr_policy.txt # Source HR policy content
│ └── faiss_index/ # Saved FAISS index files
└── hr_assistant/
├── __init__.py
├── agent.py # LangChain agent setup
├── config.py # App configuration and environment variables
├── document_loader.py # Loads raw policy text
├── embeddings.py # Jina embedding model wrapper
├── llm.py # LLM setup
├── pipeline.py # Main orchestration for the assistant
├── splitter.py # Chunking logic
├── tools.py # Retrieval tool used by the agent
└── vector_store.py # FAISS build/save/load logic
- Python 3.11+
- A Groq API key
- A Jina API key
- Git
git clone https://github.com/jaswitha112/HR-POLICY-ASSISTANT.git
cd HR-POLICY-ASSISTANTpython -m venv venvOn Windows:
venv\Scripts\activateOn macOS/Linux:
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root with the following values:
GROQ_API_KEY=your_groq_api_key
JINA_API_KEY=your_jina_api_keyThe app loads these automatically from the environment using python-dotenv.
python main.pyThis runs a few example HR questions and prints the assistant responses.
streamlit run app.pyThen open the local URL shown in the terminal and ask policy-related questions in the browser.
Example questions you can ask:
- How many paid leave days do I get?
- What is the notice period during probation?
- Can I work from home every day?
- What are the employee reimbursement rules?
- The first run may take longer because the vector store is being built from the policy file.
- The generated FAISS index is stored in
data/faiss_index/so future runs can load it quickly. - The assistant is designed to answer from retrieved policy evidence and avoid guessing when the information is not present.
This project is licensed under the MIT License. See LICENSE for details.
Contributions are welcome. If you want to improve the assistant, add new features, or make the retrieval pipeline more robust, feel free to open a pull request with a clear description of the change.
- LangChain for orchestration and agent tooling
- Groq for LLM inference
- Jina for embedding models
- FAISS for vector similarity search
- Streamlit for the interactive interface