Spaces:
Runtime error
Runtime error
Create crew.py
Browse files
crew.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from textwrap import dedent
|
| 3 |
+
from crewai import Agent, Task
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class FormFillingAgents:
|
| 7 |
+
"""Agents for form-filling tasks."""
|
| 8 |
+
|
| 9 |
+
def resume_analysis_agent(self,llm):
|
| 10 |
+
"""Creates an agent to analyze resumes and match job descriptions."""
|
| 11 |
+
return Agent(
|
| 12 |
+
role="Resume Analysis Agent",
|
| 13 |
+
llm=llm,
|
| 14 |
+
goal="Analyse the resume and extract the required information.",
|
| 15 |
+
backstory=dedent("""You are a Resume Analysis Agent that analysis provided resume
|
| 16 |
+
and extract the required information from it.Seach for the best matching job online
|
| 17 |
+
so that it can be used for further processes like Job Form Filling."""),
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
def question_answering_agent(self,llm):
|
| 21 |
+
"""Creates an agent to answer user questions."""
|
| 22 |
+
return Agent(
|
| 23 |
+
role="Question Answering Agent",
|
| 24 |
+
llm=llm,
|
| 25 |
+
goal="Answer user-provided questions accurately and correctly.",
|
| 26 |
+
backstory=dedent("""You are a Question Answering Agent
|
| 27 |
+
and you have been assigned to answer the questions asked by the users.
|
| 28 |
+
You have to make sure that the answers are correct and accurate."""),
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
class FormFillingTasks:
|
| 32 |
+
"""Tasks for form-filling processes."""
|
| 33 |
+
|
| 34 |
+
def profile_analysis_task(self, agent, resume_data, job_desc):
|
| 35 |
+
"""Creates a task for analyzing resumes against job descriptions."""
|
| 36 |
+
return Task(
|
| 37 |
+
name="Profile Analysis Task",
|
| 38 |
+
description=dedent(f"""
|
| 39 |
+
Your Task: Analyze the provided resume and job description to identify key matches and insights.
|
| 40 |
+
|
| 41 |
+
**Objectives:**
|
| 42 |
+
- Understand the company's requirements and expectations for the role by reviewing the job description.
|
| 43 |
+
- Compare and match the user's resume data to the job description, highlighting relevant skills, achievements, and experiences.
|
| 44 |
+
- Extract actionable insights from the resume that align with the role's requirements.
|
| 45 |
+
|
| 46 |
+
**Input Data:**
|
| 47 |
+
- User-provided resume: {resume_data}
|
| 48 |
+
- Job description for the role: {job_desc}
|
| 49 |
+
|
| 50 |
+
Your output should demonstrate a clear understanding of the job's demands and the user's suitability based on their resume."""),
|
| 51 |
+
expected_output=dedent(f"""You have successfully understand the companies requirement and the job description
|
| 52 |
+
try to match the resume with the job description and extract the required information."""),
|
| 53 |
+
agent=agent,
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
def question_answering_task(self, agent, questions):
|
| 57 |
+
"""Creates a task for answering questions from hiring personnel."""
|
| 58 |
+
return Task(
|
| 59 |
+
name="Question Answering Task",
|
| 60 |
+
description=dedent(f"""
|
| 61 |
+
Your Task: Respond to job application or HR-related questions by providing answers that maximize the user's chances of securing the job.
|
| 62 |
+
|
| 63 |
+
**Objectives:**
|
| 64 |
+
- Leverage the user's resume and the job description to craft tailored responses.
|
| 65 |
+
- Provide accurate, thoughtful, and professional answers that reflect the user's actual skills, experiences, and qualifications.
|
| 66 |
+
- Ensure that the answers align with the role's requirements and highlight the user's suitability.
|
| 67 |
+
|
| 68 |
+
**Guidelines:**
|
| 69 |
+
- Do **not** fabricate skills or qualifications not present in the resume.
|
| 70 |
+
- Emphasize the user's strengths, achievements, and relevance to the role.
|
| 71 |
+
- Focus on creating responses that fulfill job application requirements or address HR queries effectively.
|
| 72 |
+
|
| 73 |
+
**Input Data:**
|
| 74 |
+
- List of questions from HR or hiring personnel: {questions}
|
| 75 |
+
|
| 76 |
+
Your responses will directly impact the user's success in the application process. Aim for precision, professionalism, and alignment with the provided data."""),
|
| 77 |
+
|
| 78 |
+
expected_output="You final output must include all questions asked and their answers .",
|
| 79 |
+
agent=agent,
|
| 80 |
+
)
|
| 81 |
+
|