A conversational HR chatbot built with Python, Streamlit, LangChain, FAISS, HuggingFace Embeddings, and Groq that answers employee HR questions using a company policy document via Retrieval-Augmented Generation (RAG).
| Feature | Details |
|---|---|
| RAG Pipeline | Chunks policy.txt → embeds with all-MiniLM-L6-v2 → stores in FAISS → retrieves top-k chunks |
| Native Tool Calling | LLM automatically picks the right tool — no hardcoded routing |
| 5 LangChain Tools | search_policy, summarize_policy, list_policy_sections, create_hr_request, hr_contact |
| LLM | llama-3.3-70b-versatile via Groq API |
| UI | Clean Streamlit chat with chat history, tool badges, and a Clear Chat button |
hr_assistant/
├── app.py # Streamlit chat UI
├── agent.py # LangChain tool-calling agent (Groq LLM)
├── tools.py # All 5 LangChain tools
├── retriever.py # FAISS vector store loader and search function
├── prompts.py # System prompt for the HR Assistant
├── create_vector_db.py # One-time script to build the FAISS index
├── requirements.txt
├── .env # Your Groq API key goes here
│
└── data/
├── policy.txt # HR policy document
└── faiss_index/ # Generated by create_vector_db.py
cd hr_assistantpython -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtOpen .env and replace the placeholder:
GROQ_API_KEY=your_actual_groq_api_key_here
Get a free key at https://console.groq.com.
Run this once before starting the app:
python create_vector_db.pyThis reads data/policy.txt, creates text chunks, generates embeddings, and saves the FAISS index to data/faiss_index/.
streamlit run app.pyOpen http://localhost:8501 in your browser.
User message
│
▼
Streamlit UI (app.py)
│
▼
Agent (agent.py) ── Groq LLM (llama-3.3-70b-versatile)
│ │
│ Decides which tool to call
│
├── search_policy → FAISS similarity search (retriever.py)
├── summarize_policy → FAISS search + LLM summary
├── list_policy_sections → Returns static list of HR topics
├── create_hr_request → Generates a support ticket
└── hr_contact → Returns HR contact details
│
▼
Final answer displayed in chat UI
| Query | Tool Invoked |
|---|---|
| "How many days of annual leave do I get?" | search_policy |
| "Summarise the WFH policy" | summarize_policy |
| "What HR topics are available?" | list_policy_sections |
| "I want to report harassment by my manager" | create_hr_request |
| "How do I contact HR?" | hr_contact |
- Python 3.10+
- Streamlit – Chat UI
- LangChain – Agent framework and tool calling
- LangChain Groq – Groq LLM integration
- FAISS – Vector similarity search
- HuggingFace Embeddings –
sentence-transformers/all-MiniLM-L6-v2 - Groq – Fast LLM inference (
llama-3.3-70b-versatile) - python-dotenv – Environment variable management
- No login or authentication is required.
- No employee database is used.
- All policy answers are grounded in
data/policy.txt— the LLM never invents policies. - Re-run
create_vector_db.pywheneverpolicy.txtis updated.