An AI-powered chatbot that conducts initial candidate screenings for TalentScout, a technology recruitment agency. Built with Streamlit and Llama 3 via Groq, the assistant collects candidate information and generates tailored technical interview questions based on the candidate's declared tech stack.
- Overview
- Features
- Architecture
- Installation
- Usage Guide
- Technical Details
- Prompt Design
- Data Privacy & GDPR
- Bonus Features
- Challenges & Solutions
- Project Structure
TalentScout's Hiring Assistant ("Scout") automates the initial phase of candidate screening by:
- Greeting the candidate and explaining the process
- Collecting essential information (name, email, phone, experience, desired position, location, tech stack)
- Generating 3-5 tailored technical questions per technology in the candidate's stack
- Evaluating responses with professional, encouraging feedback
- Concluding the session with a summary and next-steps information
The chatbot maintains full conversation context, validates inputs, handles edge cases gracefully, and stores session data securely.
- Conversational Screening β Natural, step-by-step information gathering
- Dynamic Technical Questions β Generated based on candidate's tech stack & experience level
- Input Validation β Email, phone, and field-specific validation with gentle correction prompts
- Context Awareness β Full conversation history maintained for coherent follow-ups
- Fallback Handling β Graceful redirect for off-topic or unexpected inputs
- Exit Detection β Keywords like "bye", "quit", "exit" trigger graceful conclusion
- Session Persistence β Candidate data saved as JSON for recruiter review
- Sentiment Analysis β Real-time candidate mood tracking displayed in the sidebar
- Multilingual Support β Auto-detects non-English input and provides bilingual responses
- Premium UI β Custom dark theme with glassmorphism, animations, and gradient accents
graph TD
A["π€ Candidate"] -->|interacts| B["Streamlit UI"]
B -->|user message| C["Conversation Manager"]
C -->|builds prompt| D["Prompt Engine"]
D -->|API call| E["Llama 3 (Groq)"]
E -->|response| C
C -->|updates| F["Session State"]
F -->|renders| B
C -->|stores| G["Data Store (JSON)"]
subgraph "Bonus Modules"
H["Sentiment Analyzer"]
I["Multilingual Detector"]
end
C --> H
C --> I
The conversation progresses through these ordered phases:
GREETING β NAME β EMAIL β PHONE β EXPERIENCE β POSITION β LOCATION β TECH STACK β QUESTIONS β ANSWERS β FAREWELL
Each phase has:
- A tailored prompt template
- Input validation rules
- Automatic phase transition on valid input
- Fallback handling for invalid input
- Python 3.10+
- A Groq API key (Get one free here)
-
Clone the repository
git clone https://github.com/rishii100/talentscout.git cd talentscout -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate -
Install dependencies
pip install -r requirements.txt
-
Set up your API key
cp .env.example .env
-
Run the application
streamlit run app.py
-
Open in browser β Navigate to
http://localhost:8501
- Start β The assistant greets you and begins the screening
- Provide Information β Answer each question one at a time (name, email, phone, etc.)
- Declare Tech Stack β List the languages, frameworks, and tools you know
- Answer Questions β Respond to the generated technical questions
- Finish β The session ends with a summary and next-steps info
- You can type "bye", "exit", or "quit" at any time to end the session
- The sidebar shows your screening progress and collected information
- If you make a mistake, the assistant will gently ask for correction
| Library | Version | Purpose |
|---|---|---|
streamlit |
β₯1.30.0 | Frontend UI framework |
groq |
β₯0.4.0 | Groq API SDK (Llama 3) |
python-dotenv |
β₯1.0.0 | Environment variable management |
Why Groq & Llama?
- Incredible Speed β Groq's LPU architecture provides instant, real-time responses
- Quality β
llama-3.3-70b-versatileoffers top-tier instruction following and context retention - Efficiency β Uses the smaller
llama-3.1-8b-instantmodel for quick auxiliary tasks (sentiment/language detection) to save API quota - Free tier β Generous free tier for development
Configuration:
- Temperature:
0.7(balanced creativity/consistency for conversations) - Max tokens:
2048(sufficient for detailed technical questions) - Analytical tasks (sentiment, language): Temperature
0.3for precision
- State Machine β
ConversationManagerdrives the conversation through ordered phases - Template Method β Phase-specific prompts injected into a consistent prompt structure
- Strategy Pattern β Validation rules differ per phase via
_extract_and_validate() - Session State β Streamlit's
st.session_statefor conversation persistence across rerenders
Prompts are crafted with three principles:
- Specificity β Each phase has a tailored prompt that tells the LLM exactly what to do
- Constraint β Clear rules prevent the LLM from going off-topic or revealing system details
- Context β Phase context is injected alongside user input so the LLM understands the current state
The system prompt defines "Scout's" persona, rules, and behavioral constraints:
- Professional yet warm personality
- Strict topic adherence (hiring/screening only)
- One-field-at-a-time information gathering
- Input validation with gentle correction
- No code generation or tutoring β assessment only
Each conversation phase has a dedicated prompt that:
- Tells the LLM what the candidate just provided
- Specifies what to validate
- Defines what to ask next
- Handles edge cases (invalid input, off-topic responses)
The tech question prompt dynamically adjusts based on:
- Tech stack β Questions cover the specific technologies listed
- Experience level β Difficulty scales with years of experience
- Breadth β Questions cover debugging, architecture, best practices, and trade-offs
When input doesn't match the expected phase:
- Acknowledges the candidate's message politely
- Redirects to the current screening step
- Never dismisses or ignores the candidate
- Local Storage β All data stored locally in
data/candidates/as JSON files - Anonymization β Email and phone are masked in stored data (original kept for recruiter access)
- Right to Erasure β
delete_candidate_session(session_id)function available - No External Transmission β Data never leaves the local system (except API calls to Groq for response generation)
- Gitignored β The
data/candidates/directory is excluded from version control - Minimal Collection β Only essential screening information is gathered
- Each candidate message is analyzed for emotional tone
- Categories: Positive, Neutral, Negative, Frustrated, Excited, Confused
- Displayed as a color-coded badge in the sidebar
- Logged in session data for recruiter insight
- Auto-detects the candidate's language from their messages
- Supports 20+ languages including Hindi, Spanish, French, German, and more
- When non-English is detected, responses include bilingual translations
- Language detection runs on early messages to minimize API calls
- Custom dark theme with Inter font
- Glassmorphism effects and gradient accents
- Smooth message slide-in animations
- Progress bar with gradient fill
- Responsive chat bubble design
- Custom scrollbar styling
- Integrated directly into the Streamlit UI via a sidebar toggle
- Protected by environment variable credentials (
ADMIN_USERNAMEandADMIN_PASSWORD) - Allows recruiters to instantly view saved candidate JSON files and transcripts
- Eliminates the need for external database setup during local development and cloud demos
Challenge: The LLM needed to understand which phase the conversation was in without confusing past context.
Solution: Phase-specific context is injected into each prompt call, then stripped from the stored history to keep it clean. The LLM sees [SYSTEM CONTEXT β phase: X] directives that are replaced with the user's actual message in the stored history.
Challenge: LLMs naturally want to be helpful with any question, even off-topic ones. Solution: The system prompt includes strict rules about topic adherence, and the fallback mechanism provides a polite redirect template that the LLM follows consistently.
Challenge: Validating email/phone formats while keeping the conversation natural. Solution: Two-layer validation β regex-based extraction in code, plus LLM-level validation prompts that ask for corrections conversationally rather than showing error messages.
Challenge: Phrases like "thank you for asking" would trigger exit detection. Solution: Exit detection only triggers on short messages (β€5 words) containing exit keywords, preventing false positives from longer contextual sentences.
Challenge: Generating questions that are neither too easy nor too hard. Solution: The prompt includes the candidate's experience level and explicitly requests intermediate-to-advanced questions covering practical aspects (debugging, architecture, trade-offs), not just theoretical knowledge.
talentscout/
βββ app.py # Streamlit entry point
βββ config.py # API keys, constants, model configuration
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variable template
βββ .gitignore # Git ignore rules
βββ README.md # This file
β
βββ core/ # Core business logic
β βββ __init__.py
β βββ conversation.py # Conversation state machine
β βββ prompts.py # All prompt templates
β βββ llm.py # Groq (Llama) API wrapper
β βββ data_store.py # JSON data persistence
β
βββ modules/ # Bonus feature modules
β βββ __init__.py
β βββ sentiment.py # Sentiment analysis
β βββ language.py # Language detection & bilingual support
β
βββ ui/ # UI layer
β βββ __init__.py
β βββ components.py # Reusable Streamlit components
β βββ styles.py # Custom CSS injection
β
βββ data/
β βββ candidates/ # Stored session data (gitignored)
β
βββ assets/
βββ logo.png # TalentScout branding
This project was built as part of an AI/ML internship assignment. All code is original and open for review.