File size: 5,090 Bytes
4db8ed6 |
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
from typing import List, Dict, Optional
from enum import Enum
from pydantic import BaseModel, Field # , EmailStr
class MatchLabel(str, Enum):
OVER_QUALIFIED = "Over Qualified"
MATCHED = "Matched"
PARTIALLY_MATCHED = "Partially Matched"
NOT_MATCHED = "Not Matched"
class ApplicantEducation(BaseModel):
degree: str = Field(..., description="The degree obtained by the applicant")
institution: str = Field(
..., description="The institution where the degree was obtained"
)
graduation_date: str = Field(
..., description="The date of graduation in YYYY-MM format"
)
class ApplicantSkills(BaseModel):
skill_name: str = Field(..., description="The name of the skill")
proficiency: str = Field(
...,
description="The proficiency level of the skill (e.g., Advanced if more than 5 years of experience, intermediate if more than 2 years of experience, otherwise Beginner)",
)
years_of_experience: int = Field(
..., description="Number of years of experience with the skill"
)
class ApplicantExperience(BaseModel):
job_title: str = Field(
..., description="The title of the job held by the applicant"
)
company: str = Field(..., description="The company where the applicant worked")
start_date: str = Field(
..., description="The start date of the job in YYYY-MM format"
)
end_date: str = Field(..., description="The end date of the job in YYYY-MM format")
description: str = Field(
...,
description="A brief description of the job responsibilities and achievements",
)
years_of_experience: int = Field(
...,
description="Number of years of experience in this role. Rounded to the nearest integer, e.g., 1.5 years becomes 2 years",
)
class ApplicantDocument(BaseModel):
fullname: str = Field(..., description="The full name of the applicant")
email: str = Field(..., description="The email address of the applicant")
phone: str = Field(..., description="The phone number of the applicant")
description: str = Field(
..., description="A brief description or summary of the applicant's profile"
)
skills: list[ApplicantSkills] = Field(
..., description="A list of skills possessed by the applicant"
)
experiences: list[ApplicantExperience] = Field(
..., description="A list of work experiences of the applicant"
)
education: list[ApplicantEducation] = Field(
..., description="A list of educational qualifications of the applicant"
)
class JobDocument(BaseModel):
title: str = Field(..., description="The title of the job position")
responsibilities: list[str] = Field(
...,
description="A list of responsibilities associated with the job position",
)
requirements: list[str] = Field(
..., description="A list of requirements for the job position"
)
location: Optional[str] = Field(None, description="The location of the job")
salary_range: Optional[str] = Field(
None, description="The salary range for the job position, if applicable"
)
class ApplicantEvaluation(BaseModel):
match_score: float = Field(
...,
description="The match score between the applicant and the job position, ranging from 0 to 1",
)
match_reasoning: str = Field(
...,
description="The reasoning behind the match score, explaining how the applicant's qualifications align with the job requirements",
)
match_labels: MatchLabel = Field(
...,
description="The label indicating the match status between the applicant and the job position",
)
class DocumentAnnotationResponse(BaseModel):
applicant: ApplicantDocument = Field(
..., description="The applicant's information extracted from the CV"
)
job: JobDocument = Field(
..., description="The job information extracted from the job description"
)
match_score: float = Field(
...,
description="The match score between the applicant and the job position, ranging from 0 to 1",
)
match_reasoning: str = Field(
...,
description="The reasoning behind the match score, explaining how the applicant's qualifications align with the job requirements",
)
match_labels: MatchLabel = Field(
...,
description="The label indicating the match status between the applicant and the job position",
)
class DocumentAnnotationRequest(BaseModel):
applicant_cv: str = Field(..., description="Base64 encoded CV of the applicant")
job_description: str = Field(..., description="Base64 encoded job description")
applicant_email: Optional[str] = Field(
None, description="Email address of the applicant, if available"
)
applicant_phone: Optional[str] = Field(
None, description="Phone number of the applicant, if available"
)
applicant_fullname: Optional[str] = Field(
None, description="Full name of the applicant, if available"
)
|