EbukaGaus commited on
Commit
e851b13
·
1 Parent(s): 0514336
Files changed (2) hide show
  1. agents.py +45 -0
  2. tasks.py +70 -0
agents.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from crewai import Agent
2
+
3
+ def create_resume_analyst(llm):
4
+ return Agent(
5
+ llm=llm,
6
+ role="Resume Analyst",
7
+ goal="Analyze resumes and provide detailed feedback",
8
+ backstory="You're an experienced HR professional specialized in resume screening "
9
+ "and providing constructive feedback to candidates.",
10
+ allow_delegation=False,
11
+ verbose=True
12
+ )
13
+
14
+ def create_feedback_specialist(llm):
15
+ return Agent(
16
+ llm=llm,
17
+ role="Feedback Specialist",
18
+ goal="Provide actionable improvement suggestions",
19
+ backstory="You're an expert in career development and resume optimization, "
20
+ "focusing on providing specific, actionable feedback.",
21
+ allow_delegation=False,
22
+ verbose=True
23
+ )
24
+
25
+ def create_hr_problem_analyst(llm):
26
+ return Agent(
27
+ llm=llm,
28
+ role="HR Problem Analyst",
29
+ goal="Analyze HR challenges and provide practical solutions",
30
+ backstory="You're an experienced HR consultant specialized in providing "
31
+ "actionable advice for HR-related questions and challenges.",
32
+ allow_delegation=False,
33
+ verbose=True
34
+ )
35
+
36
+ def create_solution_architect(llm):
37
+ return Agent(
38
+ llm=llm,
39
+ role="Solution Architect",
40
+ goal="Provide detailed, implementable solutions",
41
+ backstory="You're an HR solution expert who provides specific, "
42
+ "practical solutions with examples and best practices.",
43
+ allow_delegation=False,
44
+ verbose=True
45
+ )
tasks.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from crewai import Task, Crew
2
+ from agents import (
3
+ create_resume_analyst,
4
+ create_feedback_specialist,
5
+ create_hr_problem_analyst,
6
+ create_solution_architect
7
+ )
8
+
9
+ def create_resume_review_crew(resume_text, llm):
10
+ resume_analyst = create_resume_analyst(llm)
11
+ feedback_specialist = create_feedback_specialist(llm)
12
+
13
+ analyze_resume = Task(
14
+ description=(
15
+ f"Analyze this resume:\n{resume_text}\n"
16
+ "1. Evaluate the overall structure and format\n"
17
+ "2. Assess the content quality and relevance\n"
18
+ "3. Identify strengths and weaknesses\n"
19
+ "4. Check for essential components"
20
+ ),
21
+ expected_output="Detailed resume analysis",
22
+ agent=resume_analyst
23
+ )
24
+ provide_feedback = Task(
25
+ description=(
26
+ "Based on the analysis, provide detailed feedback:\n"
27
+ "1. List specific improvements needed\n"
28
+ "2. Highlight positive aspects\n"
29
+ "3. Suggest concrete changes\n"
30
+ "4. Provide formatting recommendations"
31
+ ),
32
+ expected_output="Comprehensive feedback with actionable suggestions",
33
+ agent=feedback_specialist
34
+ )
35
+ return Crew(
36
+ agents=[resume_analyst, feedback_specialist],
37
+ tasks=[analyze_resume, provide_feedback],
38
+ verbose=2
39
+ )
40
+
41
+ def create_hr_crew(question, llm):
42
+ hr_analyst = create_hr_problem_analyst(llm)
43
+ solution_architect = create_solution_architect(llm)
44
+
45
+ analyze_question = Task(
46
+ description=(
47
+ f"Analyze this HR question or challenge: {question}\n"
48
+ "1. Identify the core issue\n"
49
+ "2. Consider relevant HR best practices\n"
50
+ "3. Note any potential complications"
51
+ ),
52
+ expected_output="Clear analysis with key considerations",
53
+ agent=hr_analyst
54
+ )
55
+ provide_solution = Task(
56
+ description=(
57
+ f"Based on the analysis, address this question: {question}\n"
58
+ "1. Provide specific, actionable solutions\n"
59
+ "2. Include relevant examples\n"
60
+ "3. Add implementation tips\n"
61
+ "4. Consider different organizational contexts"
62
+ ),
63
+ expected_output="Detailed, practical solution with examples",
64
+ agent=solution_architect
65
+ )
66
+ return Crew(
67
+ agents=[hr_analyst, solution_architect],
68
+ tasks=[analyze_question, provide_solution],
69
+ verbose=2
70
+ )