Check out the GenAI-Powered HR Assistant !

GenAI-Powered HR Assistant

In this project, I built a GenAI-powered HR assistant app that blends traditional data analysis with large language models to answer both factual and fuzzy employee-related queries. Using a synthetic HR dataset, the app supports interactive visual insights, performs code-driven aggregations, and responds conversationally using vector search and Gemini Pro. This hybrid approach ensures accurate, insightful, and flexible support for people analytics use cases. (A deeper dive into the dataset, methodology, and tools follows further down the page!)

🎬 See the App in Action

While the app runs smoothly most of the time, it does rely on internet connectivity, Hugging Face Spaces, and external APIs like Gemini—which can occasionally be unpredictable. To make sure you get a seamless experience no matter what, I’ve created a series of video walkthroughs that showcase the app’s key features in action. It's a polished preview of everything the HR GenAI Assistant can do—minus the loading screens! 🚀🎥

Exploring Key Insights from the HR Dataset


This video walks through the interactive Insights Dashboard of the GenAI-powered HR Assistant. It starts with a correlation heatmap showing relationships between features with at least one correlation above 0.2. For instance, JobLevel and MonthlyIncome exhibit a strong positive correlation (0.95), while YearsWithCurrentManager and YearsAtCompany also track closely—revealing tenure-linked management patterns. JobLevel and TotalWorkingYears also correlate significantly (0.77), indicating experience-driven promotion trends.

Next, count plots explore how attrition varies across categories like EnvironmentSatisfaction and MaritalStatus. One notable insight is that single employees tend to leave at a higher rate than married or divorced counterparts—possibly indicating support systems influence retention.

Finally, pie charts illustrate the distribution of demographic and work-related categories like AgeGroup, JobRole, and EducationField, providing a snapshot of workforce composition. These visual summaries help HR teams identify patterns, target interventions, and develop data-backed strategies.

Answering Aggregation-Based Questions with GenAI


This video demonstrates how the assistant handles factual, metric-based queries like "How many employees left last year?" or "What is the average salary by department?" Behind the scenes, the app uses a language model to generate Python code, which is then executed securely on the backend to produce answers from the DataFrame.

This approach offers both accuracy and flexibility—users can ask free-form questions while still getting precise, real-time data. It’s especially powerful for non-technical HR staff who want quick answers without writing code or SQL. You’ll see examples of queries, how fast the LLM responds, and the exact outputs it returns.

Fuzzy, Exploratory Questions via LLM + FAISS


In this video, the assistant tackles exploratory or open-ended HR questions like "Why do people usually leave?" or "What makes a good performer?" These are handled using retrieval-augmented generation (RAG)—where relevant insights are pulled from HR policy or documentation and passed to the Gemini Pro LLM via LangChain and FAISS.

This allows the assistant to provide informed, context-aware answers even when the question isn’t directly tied to the dataset. For example, it can describe common traits of employees who leave, referencing trends or policy descriptions stored in the vector index. This makes the assistant not just a data tool, but a conversational HR knowledge companion.

Now that you have seen the app in action, let us dive into the tech that powers it — starting with a quick look at what 'GenAI' actually is.

What is GenAI?

Generative AI (GenAI) refers to a class of models capable of generating content such as text, code, or even visuals. These models are trained on vast datasets and can perform tasks like answering questions, writing scripts, and summarizing documents. In this app, GenAI is used to interpret user queries about HR data and respond intelligently—either with natural language or generated Python code that calculates answers behind the scenes. To better understand how the app delivers intelligent responses, let us explore the core mechanisms that power it.

A Peek Under the Hood

Embeddings

Embeddings are how the LLM “understands” your HR data. I used the Hugging Face sentence-transformer model all-MiniLM-L6-v2, which converts each piece of text (like employee profiles, job descriptions, reasons for attrition) into a numerical vector. These vectors capture semantic meaning—so the assistant can find relevant context even if the exact words don’t match the user’s query.

Vectorstore with FAISS

Once the embeddings are generated, I store them in a FAISS (Facebook AI Similarity Search) index. FAISS is a high-performance library built for lightning-fast similarity search, even on large datasets. It’s ideal for querying the closest “chunks” of information when answering fuzzy or retrieval-based questions.

Alternatives to FAISS: Chroma, Weaviate, and Pinecone (a fully managed vector DB). I chose FAISS because it’s lightweight and perfect for local/portable deployment.

LangChain: The Orchestration Layer

LangChain is what brings everything together. It handles connecting to the LLM (in my case, Gemini via Google Generative AI), prompt engineering, retrieval from the FAISS vectorstore, running chains (like RetrievalQA) to combine user input, context, and LLM responses.

Alternatives to Langchain: You could also build similar workflows manually using tools like LLM API + Python scripts, or use Haystack (an open-source alternative to LangChain), but LangChain makes it very developer-friendly.

Hugging Face Spaces + Docker = Cloud Deployment

To avoid running everything on my local machine (which was... slow), I deployed the app to Hugging Face Spaces using the Docker SDK. Hugging Face Spaces is a free hosting service for ML and GenAI apps. It supports apps built with Gradio, Streamlit, or even custom Docker containers. This way the heavy lifting happens in the cloud, users can try the app right from their browser and I do not have to share API keys or embeddings locally

Project Overview

The Dataset

I used a synthetic HR dataset (1,470 rows × 36 columns) containing:

  • Demographics: Age, Gender, Marital Status
  • Job Details: Role, Department, Years at Company
  • Satisfaction and Performance Scores
  • Attrition Status: Whether an employee has left

Tools & Stack

Tool Purpose
StreamlitFrontend interface
LangChainPrompt routing and model interaction
Gemini Pro (ChatGoogleGenerativeAI)LLM powering both query types
FAISSVector-based semantic search
Hugging Face SpacesDeployment platform
Python & PandasData manipulation

Alternatives:

  • LLMs: GPT-4, Claude, Mistral
  • Vector Store: ChromaDB, Pinecone
  • Frontend: Gradio, Flask + React

Lessons Learned While Debugging

🚀 Slow local loading of embedding models

Solution: Cached models using @st.cache_resource, and saved embeddings and vectorstore locally improving dev speed and responsiveness..

🐢 Heavy LLM calls slowing down the app

Solution: Deployed to Hugging Face Spaces, freeing up local compute and boosting app performance.

🔄 Long response times for aggregation-based queries

Solution: Separated aggregation and fuzzy query pipelines. For structured queries, I routed them through a custom code-gen pipeline that bypasses the LLM and executes Python directly for faster responses.

GenAI-Powered HR Assistant