This project implements an intelligent Hiring Assistant chatbot for "TalentScout," a fictional recruitment agency specializing in technology placements. The chatbot assists in the initial screening of candidates by gathering essential information and generating relevant technical questions based on the candidate's declared tech stack.
- Streamlit UI: Clean, intuitive interface with sidebar controls
- Input Validation: Comprehensive validation for all user inputs
- Dynamic Question Generation: Uses OpenAI GPT to generate tailored technical questions
- Conversation Management: Handles retry, restart, and exit commands
- Progress Tracking: Visual progress indicator and data display
- Modular Architecture: Clean separation of concerns across multiple files
chatbot/
βββ main.py # Main Streamlit application
βββ config.py # Configuration and constants
βββ validators.py # Input validation functions
βββ session_manager.py # Session state management
βββ conversation_handler.py # Main conversation logic
βββ ai_service.py # OpenAI integration
βββ utils.py # Utility functions and UI helpers
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variable template
βββ README.md # This file
βββ pyproject.toml # Project configuration
βββ uv.lock # uv lock file
- Install dependencies using uv package manager:
uv pip install -r requirements.txt
Run the Streamlit application:
streamlit run main.pyThe application will open in your browser at http://localhost:8501
- Greeting: The chatbot introduces itself and explains available commands
- Information Collection: Validates and collects candidate details:
- Full Name (letters and spaces only)
- Email Address (valid email format)
- Phone Number (exactly 10 digits)
- Years of Experience (whole numbers 0-50)
- Desired Position(s) (comma-separated list)
- Current Location (any text)
- Tech Stack (any text)
- Question Generation: Creates technical questions based on tech stack
- Conversation Management: Handles special commands and maintains state
exit,quit,bye,end- End the conversationretry,try again- Repeat the current questionrestart,start over- Start from the beginning
Main Streamlit application entry point. Handles UI setup and user interaction flow.
Contains configuration constants including:
- Question steps and validation mapping
- Command keywords
- Initial greeting message
Input validation functions for each data type:
- Name validation (letters/spaces only)
- Email format validation
- Phone number validation (10 digits)
- Experience validation (whole numbers)
- Position parsing (comma-separated)
- Location and tech stack validation
Session state management and utility functions:
- Session initialization
- Message handling
- Conversation state tracking
- Chat history display
Main conversation processing logic:
- User input processing
- Command handling (exit, retry, restart)
- Validation orchestration
- Question flow management
OpenAI integration for generating technical questions:
- API client setup
- Question generation based on tech stack
- Error handling for API failures
UI utility functions:
- Sidebar creation with progress tracking
- Help documentation display
- Data export functionality
- Language: Python 3.13+
- Frontend: Streamlit
- LLM: OpenAI GPT-3.5-turbo
- Package Manager: uv
- Architecture: Modular design with separation of concerns
- No candidate data is permanently stored
- All interactions are session-based
- API calls are made securely to OpenAI
- Follows data privacy best practices
To extend the chatbot:
- Add new validation: Create function in
validators.py - Add new question step: Update
STEPSinconfig.py - Modify conversation flow: Update
conversation_handler.py - Add UI features: Extend
utils.py - Change AI behavior: Modify
ai_service.py
- Database integration for candidate storage
- Multi-language support
- Advanced question difficulty levels
- Interview scheduling integration
- Sentiment analysis
- Custom company branding
MIT License
- OpenAI GPT-3.5-turbo: Cloud-based AI (requires API key)
- Llama 3.1 8B (Ollama): Local AI model (private & free)
-
AI Provider Selection:
- Dropdown in sidebar to switch between OpenAI and Ollama
- Real-time status indicators (β /β)
- Automatic availability detection
-
Enhanced UI:
- AI provider status display
- Setup instructions for Ollama
- Progress tracking for conversation
- Better organized sidebar
-
Improved Question Generation:
- Better prompts for both AI providers
- Error handling for both services
- Fallback mechanisms
-
Setup Automation:
setup_ollama.shscript for easy installation- Comprehensive documentation
- Troubleshooting guide
chatbot/
βββ main.py # Main app with AI provider display
βββ config.py # AI provider configuration
βββ ai_service.py # Dual AI integration (OpenAI + Ollama)
βββ utils.py # Enhanced sidebar with AI controls
βββ session_manager.py # Session state management
βββ conversation_handler.py # Conversation processing
βββ validators.py # Input validation
βββ setup_ollama.sh # Automated Ollama setup
βββ OLLAMA_GUIDE.md # Comprehensive Ollama guide
βββ requirements.txt # Updated dependencies
βββ .env.example # Environment configuration
# 1. Install Ollama and Llama 3.1 8B
./setup_ollama.sh
# 2. Start the chatbot
streamlit run main.py
# 3. Select "Llama 3.1 8B (Ollama)" from the sidebar# 1. Set your OpenAI API key
export OPENAI_API_KEY="your-key-here"
# 2. Start the chatbot
streamlit run main.py
# 3. Select "OpenAI GPT-3.5-turbo" from the sidebar-
Sidebar AI Configuration:
- β Available AI providers
- β Unavailable providers with setup instructions
- Current provider selection
-
Main Chat Interface:
- Current AI provider display
- All existing chatbot functionality
- Enhanced help documentation
-
Real-time Status:
- Ollama connection status
- Model availability
- Error messages with solutions
- Local Processing: Ollama runs entirely on your machine
- No Data Transmission: Candidate data never leaves your system
- Zero API Costs: Free after initial setup
- Faster Responses: No network latency with Ollama
- Reliability: No internet dependency
- Customizable: Can fine-tune models for specific needs
- Easy Switching: Toggle between AI providers instantly
- Fallback Options: Multiple AI providers available
- Extensible: Easy to add more AI providers
| Feature | OpenAI GPT-3.5-turbo | Llama 3.1 8B (Ollama) |
|---|---|---|
| Privacy | Cloud-based | 100% Local |
| Cost | Pay per use | Free after setup |
| Speed | Fast | Medium |
| Quality | Very High | High |
| Setup | API key only | Install + Download |
| Internet | Required | Not required |
- Try Both Providers: Test the differences in question quality
- Customize Prompts: Modify prompts in
ai_service.py - Add More Models: Extend to support other Ollama models
- Fine-tune: Train Llama on your specific interview data
- Deploy: Set up production deployment with both providers
If you see "β Ollama not available":
- Run
./setup_ollama.sh - Ensure Ollama is running:
ollama serve - Check the model is downloaded:
ollama list
Your chatbot now supports both cloud-based and local AI processing, giving you the best of both worlds:
- OpenAI: For maximum quality and speed
- Ollama: For privacy, cost-effectiveness, and offline use
Switch between them anytime using the sidebar dropdown!