-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathcv-analysis.py
More file actions
108 lines (93 loc) · 3.7 KB
/
cv-analysis.py
File metadata and controls
108 lines (93 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
from praisonaiagents import Agent, Task, PraisonAIAgents
from pydantic import BaseModel
from typing import List, Dict
# Define structured output models
class SkillAnalysis(BaseModel):
technical_skills: List[str]
soft_skills: List[str]
skill_gaps: List[str]
recommendations: List[str]
class ExperienceAnalysis(BaseModel):
key_achievements: List[str]
impact_metrics: List[Dict[str, str]]
areas_of_expertise: List[str]
improvement_suggestions: List[str]
class CVAnalysisReport(BaseModel):
overall_score: int
key_strengths: List[str]
areas_for_improvement: List[str]
market_fit: str
recommendations: List[str]
skill_analysis: SkillAnalysis
experience_analysis: ExperienceAnalysis
# Create specialized agents
skill_analyst = Agent(
role="Skills Analysis Expert",
goal="Analyze technical and soft skills in CV",
backstory="""You are an experienced skills analyst with deep knowledge of industry requirements
and current market trends. You excel at identifying valuable skills and potential skill gaps.""",
verbose=True
)
experience_analyst = Agent(
role="Experience Analysis Expert",
goal="Analyze professional experience and achievements",
backstory="""You are an expert in evaluating professional experience and achievements.
You can identify impactful contributions and quantifiable results.""",
verbose=True
)
cv_evaluator = Agent(
role="Senior CV Evaluator",
goal="Provide comprehensive CV evaluation and recommendations",
backstory="""You are a senior CV evaluation expert with years of experience in talent assessment.
You provide detailed analysis and actionable recommendations for CV improvement.""",
verbose=True
)
# Create tasks with structured outputs
skills_analysis_task = Task(
description="""Analyze the CV's technical and soft skills. Identify skill gaps and provide recommendations
for skill development based on current market trends.""",
expected_output="Detailed analysis of skills with recommendations",
agent=skill_analyst,
output_pydantic=SkillAnalysis,
context=["test"],
)
experience_analysis_task = Task(
description="""Evaluate professional experience, achievements, and impact.
Identify key accomplishments and areas of expertise.""",
expected_output="Comprehensive analysis of professional experience",
agent=experience_analyst,
output_pydantic=ExperienceAnalysis
)
final_evaluation_task = Task(
description="""Review all analyses and provide a comprehensive evaluation of the CV.
Include overall assessment, key strengths, areas for improvement, and specific recommendations.""",
expected_output="Final CV evaluation report",
agent=cv_evaluator,
context=[skills_analysis_task, experience_analysis_task],
output_pydantic=CVAnalysisReport
)
# Create and run the agents
agents = PraisonAIAgents(
agents=[skill_analyst, experience_analyst, cv_evaluator],
tasks=[skills_analysis_task, experience_analysis_task, final_evaluation_task],
process="sequential",
verbose=True
)
# Start the analysis
result = agents.start()
# Access the structured results
print("\nCV Analysis Results:")
print(f"\nOverall Score: {result.pydantic.overall_score}/100")
print("\nKey Strengths:")
for strength in result.pydantic.key_strengths:
print(f"- {strength}")
print("\nSkill Analysis:")
print("\nTechnical Skills:")
for skill in result.pydantic.skill_analysis.technical_skills:
print(f"- {skill}")
print("\nExperience Highlights:")
for achievement in result.pydantic.experience_analysis.key_achievements:
print(f"- {achievement}")
print("\nRecommendations:")
for recommendation in result.pydantic.recommendations:
print(f"- {recommendation}")