An automated voice-based AI system for conducting initial candidate screening interviews. The system uses natural language processing and speech recognition to evaluate candidates' responses and provide structured feedback.
- Automated Phone Interviews: Conducts phone interviews using AI-generated voice
- Real-time Transcription: Converts candidate responses to text using OpenAI Whisper
- Sentiment Analysis: Evaluates candidate's tone and sentiment
- Keyword Extraction: Identifies key skills and qualifications
- Decision Engine: Provides structured recommendations based on responses
- Backend Framework: FastAPI
- Voice Calls: Twilio
- Speech-to-Text: OpenAI Whisper
- Text-to-Speech: Google Cloud TTS
- NLP: HuggingFace Transformers, spaCy
- Sentiment Analysis: VADER
- Python 3.8 or higher
- Twilio Account (for voice calls)
- Google Cloud Account (for Text-to-Speech)
- OpenAI API key (for Whisper, optional if using local model)
- Clone the repository:
git clone <repository-url>
cd voice-ai-hr-agent- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Install spaCy English model:
python -m spacy download en_core_web_sm- Create a
.envfile in the project root with the following variables:
# Twilio Configuration
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number
# Google Cloud Configuration
GOOGLE_CLOUD_PROJECT_ID=your_project_id
GOOGLE_APPLICATION_CREDENTIALS=path_to_credentials.json
# Application Configuration
APP_HOST=0.0.0.0
APP_PORT=8000
DEBUG=True
BASE_URL=http://localhost:8000- Start the FastAPI server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000- The API will be available at
http://localhost:8000
GET /: Health check endpointPOST /initiate-call: Start a new interview callPOST /process-response: Process candidate's audio responseGET /health: Application health check
- Initiate a call:
import requests
response = requests.post(
'http://localhost:8000/initiate-call',
json={'phone_number': '+1234567890'}
)
print(response.json())- The system will:
- Call the candidate
- Ask screening questions
- Process responses in real-time
- Generate a structured evaluation
{
"candidate_name": "John Doe",
"skills": ["Python", "React", "AWS"],
"experience": "5 years",
"location": "New York",
"sentiment": "Positive",
"decision": "Recommend",
"reason": "Strong candidate with good skills and positive interaction"
}The system includes mock functions for testing without external API dependencies:
# Mock a call without Twilio
call_handler = CallHandler()
result = call_handler.mock_call()
# Mock transcription without Whisper
stt = SpeechToText()
result = stt.mock_transcribe("Sample response")The system includes comprehensive error handling for:
- Failed API calls
- Audio processing issues
- NLP analysis errors
- Decision engine failures
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.