parser_prompt = f""" You are an intelligent resume parser for the HR department. Read the raw CV text delimited by <<< and >>>, then return a single valid JSON object—no markdown, no commentary.
<<< {text}
Schema to follow exactly:
{{ "name": "", "email": "", "phone": "", "location": "", "skills": [], "education": [{{"degree": "","institution": "","year": ""}}], "certificates": [{{"name": "","issuing_organization": "","year": ""}}], "professional_history": [{{"job_title": "","company": "","start_date": "","end_date": "","description": ""}}], "eligible_departments": [] }}
For "eligible_departments", choose zero or more items from this closed list: ["BPO Marketing","Call Center","Content Writer","Data Entry","HR Department","Android","iOS","Network","Software Engineer"].
If a field is missing in the source text, return an empty string, zero, or empty list as appropriate. Produce nothing but the JSON object. """
parser_response = openai.ChatCompletion.create( model="gpt-4o-mini", response_format={"type": "json_object"}, temperature=0.0, messages=[ {"role": "system", "content": "You are a fault-tolerant JSON generator."}, {"role": "user", "content": parser_prompt} ] ) candidate_json = parser_response.choices[0].message.content
industry_list = ["FinTech","Healthcare","E-commerce","Telecom","Manufacturing","Education","Consulting","Government"]
recruiter_prompt = f""" You are an expert technical recruiter. Evaluate the candidate JSON below.
Input JSON: {candidate_json}
Instructions:
- For each entry in "eligible_departments", pick the single most likely job role title and craft a concise standard job description (≤ 80 words).
- Score these six criteria—education, years_of_experience, relevant_technologies_tools, projects_or_responsibilities, soft_skills, certifications—each from 0 (poor) to 2 (strong). Sum to a raw 0-12, then rescale to one decimal out of 10 for "total_score".
- Set "year_of_experience" to the rounded total number of professional years derived from the timeline.
- job_hopping = "yes" if the candidate held ≥ 3 roles of < 18 months each within the last five years, else "no".
- status = "yes" if total_score ≥ 7.0 and job_hopping == "no"; otherwise "no".
- Choose exactly one "industry" from this list: {industry_list}.
- Return only the following JSON object:
{{ "job_role": "", "standard_job_description": "", "criteria_evaluation": {{ "education": {{"score": 0,"comments": ""}}, "years_of_experience": {{"score": 0,"comments": ""}}, "relevant_technologies_tools": {{"score": 0,"comments": ""}}, "projects_or_responsibilities": {{"score": 0,"comments": ""}}, "soft_skills": {{"score": 0,"comments": ""}}, "certifications": {{"score": 0,"comments": ""}} }}, "total_score": 0.0, "strengths": [], "gaps": [], "job_hopping": "", "status": "", "industry": "", "year_of_experience": 0, "final_verdict": "" }}
Do not output markdown tables or any explanatory prose—return the JSON object only. """
recruiter_response = openai.ChatCompletion.create( model="gpt-4o-mini", response_format={"type": "json_object"}, temperature=0.0, messages=[ {"role": "system", "content": "You are a decisive, metrics-driven recruiter."}, {"role": "user", "content": recruiter_prompt} ] ) evaluation_json = recruiter_response.choices[0].message.content print(evaluation_json)