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" )