Skip to content

An AI-powered HR assistant that uses Retrieval-Augmented Generation (RAG) with FastAPI & Streamlit to answer employee queries, search profiles, and simplify HR resource management

Notifications You must be signed in to change notification settings

Sourav-x-3202/HR_ChatBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HR Resource Query Chatbot

Python
FastAPI
Streamlit
Torch
License


An intelligent HR assistant chatbot that helps you query employee data in natural language.
It combines semantic retrieval with LLM-powered generation using a hybrid RAG (Retrieval-Augmented Generation) approach.

With this tool, you can ask:

  • "Show me backend developers in Bengaluru with 5+ years of experience"
  • "Who are the UI/UX designers skilled in Figma?"
  • "List employees with leadership roles in sales"

and get chat-style responses with matching employee details.


Features

  • Semantic Search → Search employees by role, skills, experience, and location.
  • Conversational Chat → Ask questions in plain English.
  • FastAPI Backend → Exposes REST endpoints for integration.
  • Streamlit Frontend → Interactive chat-like interface.
  • Hybrid RAG Engine → Combines embeddings (sentence-transformers) with Gemini LLM for contextual answers.
  • Extendable Dataset → Add/update employees in data.py or link to your HR database.
  • Fallback Mode → Even without Gemini API, retrieval still works.

System Architecture

hr_chatbot_architecture

Project Structure

HR_ChatBot/
│── 📜 app.py             # Streamlit frontend (chat interface)
│── 📜 main.py            # FastAPI backend (API endpoints)
│── 📜 rag.py             # RAG engine (semantic search + LLM)
│── 📜 data.py            # Employee seed dataset
│── 📜 requirements.txt   # Python dependencies
│── 📜 README.md          # Project documentation
│
└── 📂 assets/            # (Optional) Screenshots & demo images
    ├── ui_demo.png
    └── architecture.png

Setup & Installation

1. Clone Repository

git clone https://github.com/your-username/HR_ChatBot.git
cd HR_ChatBot

2. Create Virtual Environment

python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

Configure Gemini API

Obtain an API key from Google AI Studio. Set it as an environment variable:

# Windows PowerShell
$env:GEMINI_API_KEY="YOUR_KEY"

# macOS/Linux
export GEMINI_API_KEY="YOUR_KEY"

If no key is set, the chatbot falls back to retrieval-only answers.


Run the App

Start Backend (FastAPI)

uvicorn main:app --reload

Start Frontend (Streamlit)

streamlit run app.py

Screenshots

Chat UI (Streamlit) Screenshot 2025-08-31 044950

Employee Search Result Screenshot 2025-08-31 045109


Employee Dataset

  • Seed data is in data.py.
  • Each employee contains:
{
  "id": 1,
  "name": "Alice Johnson",
  "role": "Backend Developer",
  "skills": ["Python", "Django", "PostgreSQL"],
  "experience": 5,
  "location": "Bengaluru"
}
  • Extendable: Replace with CSV, DB, or API integration.

Notes

  • Works with Python 3.10 – 3.13.
  • For Python 3.13, use PyTorch ≥ 2.6.0.
  • For GPU users, install CUDA-enabled PyTorch manually:
# Example for CUDA 12.1 on Windows
pip install torch --index-url https://download.pytorch.org/whl/cu121
  • If Gemini API is down, app gracefully falls back to retrieval answers.

Contributing

Want to improve this project? Contributions are welcome!

  • Fork the repo
  • Create your feature branch → git checkout -b feature/my-feature
  • Commit changes → git commit -m "Add my feature"
  • Push branch → git push origin feature/my-feature
  • Open a Pull Request

Author

Sourav Sharma Developer. Maker. Privacy-first AI enthusiast. Find me on GitHub → @Sourav-x-3202


Star This Project

If you found this useful, helpful, or inspiring — please consider starring the repository. It helps others discover the project and keeps development going


License

This project is licensed under the MIT License. © 2025 Sourav Sharma

About

An AI-powered HR assistant that uses Retrieval-Augmented Generation (RAG) with FastAPI & Streamlit to answer employee queries, search profiles, and simplify HR resource management

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages