The TalentScout Hiring Assistant is a Streamlit-based chatbot designed to streamline the initial HR screening process for job candidates. It collects essential candidate information (e.g., name, email, tech stack), requests consent for data storage to simulate GDPR compliance, and generates 2-3 technical questions per skill in the candidate’s tech stack. The chatbot provides feedback on answers, saves responses to a JSON file (data/candidate_response.json) for technical review, and ensures a conversational, user-friendly experience. This project demonstrates skills in Python, Streamlit, API integration, and data privacy considerations.
Follow these steps to set up and run the application locally:
-
Clone the Repository:
git clone https://github.com/your-username/TalentScout-Hiring-Assistant.git cd TalentScout-Hiring-Assistant -
Set Up a Virtual Environment:
python -m venv venv .\venv\Scripts\activate # On Windows # OR source venv/bin/activate # On Mac/Linux -
Install Dependencies:
pip install -r requirements.txtEnsure
requirements.txtincludes:streamlit google-generativeai -
Set Up API Key:
-
Create a
.envfile in the project root and add your Gemini API key:GEMINI_API_KEY=your-api-key-here -
The app loads this key using
dotenv.
-
- Run the Application:
-
Activate the virtual environment if not already active:
.\venv\Scripts\activate # On Windows # OR source venv/bin/activate # On Mac/Linux -
Use the VS Code task to run the app:
- Press
Ctrl+Shift+Bto run the "Run Streamlit App" task (configured in.vscode/tasks.json).
- Press
-
Alternatively, run manually:
streamlit run src/app.py
-
- Access the App:
- Open the provided URL (e.g.,
http://localhost:8501) in your browser.
- Open the provided URL (e.g.,
- Interact with the Chatbot:
- Provide candidate details as prompted (e.g., name, email, tech stack).
- Consent to data storage when asked (type "Yes" or "No").
- Answer technical questions for each skill in your tech stack.
- Receive confirmation that your information has been submitted for review.
- Libraries Used:
streamlit: For building the interactive web interface.google-generativeai: To integrate the Gemini 1.5 Flash model for generating technical questions.uuid,datetime,json,os: For handling candidate data, timestamps, and file storage.
- Model Details:
- The chatbot uses the Gemini 1.5 Flash model (
gemini-1.5-flash) to generate technical questions based on the candidate’s tech stack and desired position. - The model is accessed via an API key stored in a
.envfile.
- The chatbot uses the Gemini 1.5 Flash model (
- Architectural Decisions:
- The app is structured into two main files:
app.py(Streamlit frontend) andchatbot.py(chatbot logic), promoting modularity and maintainability. - Candidate data is stored in a JSON file (
data/candidate_response.json) to simulate a backend database, suitable for a demo project. - A state machine approach in
chatbot.pymanages the conversation flow: collecting info, requesting consent, asking technical questions, and saving data. - Input validation (e.g., email, phone number, technical answers) ensures robustness.
- The app is structured into two main files:
- Information Gathering:
-
Prompts are designed to be conversational and varied to avoid repetition. For example, to collect the candidate’s email:
"Thanks, {name}! Could you share your email address so we can stay in touch?" -
Each field (e.g., name, tech stack) has multiple prompt variations to enhance user experience.
-
- Technical Question Generation:
-
The prompt for generating technical questions is crafted to ensure relevance and difficulty variation:
"Generate 2-3 technical questions to assess proficiency in {skill} for a candidate applying for a {position} role. Format each question as a numbered item (e.g., '1. Question text'). Ensure the questions are relevant to the role, range from basic to advanced, cover practical applications, and are appropriate for the technology or framework. If {skill} is an obscure or unfamiliar technology, generate general problem-solving questions related to software development or the candidate’s role." -
This prompt ensures the questions are tailored to the candidate’s role and tech stack, with a fallback for niche skills.
-
- Feedback and Validation:
- Prompts for invalid answers (e.g., "Hmm, that doesn’t seem to answer the question, {name}. Could you provide more details?") guide the candidate to improve their responses.
- Challenge: Generating relevant technical questions for diverse tech stacks, including niche technologies.
- Solution: The prompt for question generation includes a fallback to general problem-solving questions if the tech stack is obscure, ensuring the chatbot always has questions to ask.
- Challenge: Ensuring GDPR compliance in a simulated environment.
- Solution: Added a consent step before storing data, with a clear message: "Before we proceed, we need your consent to store your information for the hiring process. Do you consent to this? (Yes/No)". Data is only saved if consent is given.
- Challenge: Asking multiple questions per skill without breaking the conversation flow.
- Solution: Fixed the state machine in
chatbot.pyto iterate through all questions for a skill before moving to the next, usingcurrent_question_indexandcurrent_skill_indexto track progress.
- Solution: Fixed the state machine in
- Challenge: Running the app efficiently in VS Code.
- Solution: Created a VS Code task in
.vscode/tasks.jsonto automate activating the virtual environment and running the app with a single shortcut (Ctrl+Shift+B).
- Solution: Created a VS Code task in
- Storage: Candidate information and responses are saved to
data/candidate_response.jsonin a simulated format. - Simulated Data: The app uses simulated data for all backend processes, ensuring no real personal data is stored.
- Data Privacy:
- Requests candidate consent before storing data (simulated GDPR compliance).
- In a production environment, ensure compliance with GDPR by:
- Encrypting sensitive fields (e.g., email, phone number) using AES-256 encryption.
- Implementing role-based access controls.
- Anonymizing or pseudonymizing data where possible.
- Providing candidates with the ability to request data deletion.
- After the HR round, the candidate’s data is saved with a unique
candidate_id, timestamp, and status ("HR Round Completed - Ready for Technical Review"). - The candidate is informed that the technical team will review their responses and reach out within a week for the next round.
.
├── src/
│ ├── app.py # Main Streamlit app
│ ├── chatbot.py # Chatbot logic
├── data/
│ ├── candidate_response.json # Stored candidate data
├── .vscode/
│ ├── tasks.json # VS Code task to run the app
├── .env # Environment variables (e.g., API key)
├── .gitignore # Git ignore file
├── requirements.txt # Project dependencies
└── README.md # Project documentation