AI-Resume-Ranking-hybrid / utils /prompts-bug.py
yhng2525's picture
bug fixing, return to original prompt.py with Recall strategy added
99de8bf
# %%writefile utils/prompts.py
JD_PROMPT = """
## Task
Given the following Job Description, extract a structured hiring rubric.
## Strategy for High Recall:
- **Scan the ENTIRE text**: Important skills (like Data Governance or AI) are often buried in "Responsibilities" \
or "About the Team" sections, not just "Qualifications."
- **Capture Minima**: If multiple experience levels are mentioned (e.g., 5 years for Senior, 2 years for Mid), \
extract the ABSOLUTE minimum required to enter the role.
- **Bonus Skills**: Include specialized interests or "plus" items mentioned in the text as Nice-to-Have skills.
## Hard rules:
1) Output MUST be valid JSON only (no markdown, no commentary).
2) Follow the exact JSON keys and structure shown in "OUTPUT JSON FORMAT".
3) Use concise phrases, not full sentences, for skill items.
4) Deduplicate list items (case-insensitive). Strip extra spaces.
5) Keep list sizes bounded:
- must_have_skills: max 12 items
- nice_to_have_skills: max 10 items
6) If the JD is unclear or does not state a field, use:
- empty string "" for string fields
- [] for list fields
- 0 for minimum_years_experience
7) Education:
- Only include explicit minimum education requirements.
- Use short normalized phrases (e.g., "Bachelor's in Computer Science or related field").
8) recommended_weights:
- All values must be integers.
- Must sum to exactly 100.
- If uncertain, use a reasonable default split, but still sum to 100.
## Output
OUTPUT JSON FORMAT (must match exactly):
{
"role_title": "",
"must_have_skills": [],
"nice_to_have_skills": [],
"minimum_years_experience": 0,
"minimum_education_requirements": [],
"soft_skills": [],
"recommended_weights": {
"must_have_skills": 0,
"nice_to_have_skills": 0,
"soft_skills": 0,
"experience": 0,
"education": 0
}
}
Job Description:
----------------
{jd_text}
"""
RESUME_PARSE_PROMPT = """
You are an experienced HR resume analyst.
Given the following resume text, extract a structured candidate profile.
Return STRICT JSON with these fields:
- name
- technical skills (list)
- soft skills (list)
- education (list)
- work_experience (list of short role summaries)
- total_years_experience (number)
- summary (2–3 sentence professional summary)
Resume Text:
-------------
{resume_text}
IMPORTANT:
- Output JSON only
- Do not include explanations
"""
JD_RESUME_MATCH_PROMPT = """
You are an experienced HR hiring analyst.
You will be given:
1. A structured Job Description rubric (JSON)
2. A structured candidate profile (JSON)
Your task:
- Compare the candidate against the JD rubric
- Identify matches, partial matches, and gaps
- Identify positive and negative indicators
- DO NOT calculate a score
- Be factual and conservative
- Do NOT infer sensitive personal attributes
- Output ONLY valid JSON in the specified schema
- IMPORTANT: Include selected JD rubric fields verbatim in the output for auditability
Matching rules:
- A skill is matched if clearly demonstrated in experience or skills
- Partial if loosely related or implied
- Missing if not found
Education rules:
- Compare candidate education list against the JD minimum_education_requirements list
- "meets" if at least one listed minimum requirement is clearly satisfied (or higher)
- "partial" if education is present but unclear / not directly matching
- "missing" if no relevant education is found
Soft skills rules:
- Match soft skills only if explicitly present in resume/profile or clearly stated in summaries
- Be conservative
Output JSON schema (STRICT):
{
"role_title": "",
"candidate_name": "",
"jd_rubric_snapshot": {
"minimum_years_experience": 0,
"minimum_education_requirements": [],
"recommended_weights": {
"must_have": 0,
"nice_to_have": 0,
"experience": 0,
"education": 0,
"soft_skills": 0
},
"must_have_skills": [],
"nice_to_have_skills": [],
"soft_skills": []
},
"must_have_match": {
"matched": [],
"missing": [],
"partial": []
},
"nice_to_have_match": {
"matched": [],
"missing": []
},
"soft_skills_match": {
"matched": [],
"missing": []
},
"experience_analysis": {
"required_years": 0,
"candidate_years": 0,
"assessment": "below | meets | exceeds"
},
"education_analysis": {
"requirements": [],
"candidate_education": [],
"assessment": "missing | partial | meets"
},
"positive_indicators": [],
"negative_indicators": [],
"overall_fit_summary": ""
}
IMPORTANT:
- role_title MUST be copied from the JD rubric's role_title
- jd_rubric_snapshot fields MUST be copied from the JD rubric (verbatim lists and numbers)
- education_analysis.requirements MUST equal JD rubric minimum_education_requirements
- education_analysis.candidate_education MUST equal candidate profile education list
- Output JSON only (no markdown, no commentary)
"""