Overview
The LinkedIn Job Analyzer integrates OpenAI’s GPT-3.5-turbo model to generate intelligent summaries and insights from raw job descriptions. The AI analysis is triggered on-demand when users request a professional breakdown of the job requirements.AI analysis is optional and only runs when explicitly requested by the user
Architecture
The AI analysis system is implemented in a single class that handles OpenAI API communication:gpt_analyzer.py:9-23
Environment Configuration
The analyzer requires an OpenAI API key stored in environment variables:Analysis Method
The core analysis methodgenerar_resumen takes a job title and list of skills, then generates a structured professional summary:
gpt_analyzer.py:25-36
Safety Checks
API Key Validation
API Key Validation
Verifies that the OpenAI client was initialized successfully before making API calls
Empty Data Handling
Empty Data Handling
Returns a user-friendly message if no skills were extracted from the job posting
Prompt Engineering
The analyzer uses a carefully crafted prompt to generate structured, actionable insights:gpt_analyzer.py:38-59
Prompt Structure
API Request Configuration
The analyzer makes a chat completion request with optimized parameters:gpt_analyzer.py:61-73
Parameter Breakdown
The OpenAI model used for generation. Can be upgraded to
gpt-4o-mini or gpt-4 for higher qualityConversation context with system role and user prompt
Controls randomness (0.7 balances creativity with consistency)
Limits response length to control costs
Generated Insights
The AI generates a structured analysis with four key sections:Objetivo del Rol
A one-sentence summary of what the employer is looking for
Stack Tecnológico Principal
The 5 most important technologies and tools mentioned
Skills Blandas
Soft skills and personal attributes required
Nivel de Experiencia
Inferred seniority level (Junior, Mid, or Senior)
Example Output
Sample AI-Generated Summary
Error Handling
The analyzer includes robust error handling for API failures:gpt_analyzer.py:75-77
Common Error Scenarios
Invalid API Key
Invalid API Key
Returns authentication error message if the key is incorrect or expired
Rate Limits Exceeded
Rate Limits Exceeded
Handles OpenAI rate limiting errors gracefully
Insufficient Credits
Insufficient Credits
Returns a clear message if the OpenAI account has no remaining balance
Network Issues
Network Issues
Catches connection errors and timeouts
Usage Example
Using the AIAnalyzer
Cost Optimization
The analyzer implements several strategies to minimize API costs
- Skill Limit: Only the first 30 skills are analyzed (gpt_analyzer.py:41)
- Token Cap: Maximum response length set to 500 tokens (gpt_analyzer.py:69)
- Model Choice: Uses GPT-3.5-turbo by default (cheaper than GPT-4)
- On-Demand Only: Analysis only runs when explicitly requested
Customization Options
Upgrade Model
Change
model="gpt-3.5-turbo" to gpt-4o-mini or gpt-4 for better qualityAdjust Temperature
Modify
temperature (0.0-2.0) to control output randomnessIncrease Token Limit
Raise
max_tokens for longer, more detailed responsesAnalyze More Skills
Change
habilidades[:30] to include more skills in the analysis