53 lines
2.2 KiB
Python
53 lines
2.2 KiB
Python
"""Employment LLM prompt builders.
|
|
|
|
Pure module: no FastAPI imports and no HTTPException.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
NO_COMPANY="no company was mentioned"
|
|
EDUCATION="No Education Mentioned"
|
|
CURRENT_TITLE="No JOB POSITION MENTIONED"
|
|
NO_LINKEDIN="no linkedin url mentioned"
|
|
|
|
|
|
def prompt():
|
|
return f"""You are an HR-ATS recruiting assistant.
|
|
|
|
You are given CV/resume text. Identify the candidate's CURRENT employer company
|
|
name, their education (degree / school), their current job title, and their
|
|
LinkedIn profile URL when present.
|
|
|
|
Rules:
|
|
- Return only the company name that appears in the resume text for the ongoing / most recent role.
|
|
- Return only education that appears in the resume text.
|
|
- Return only job title that appears in the resume text.
|
|
- The company string you return MUST appear verbatim (or as a clear substring) in the resume text.
|
|
- The education string you return MUST appear verbatim (or as a clear substring) in the resume text.
|
|
- The job title string you return MUST appear verbatim (or as a clear substring) in the resume text.
|
|
- Do not invent a company. If none is mentioned, return exactly: {NO_COMPANY}
|
|
- Do not invent education. If none is mentioned, return exactly: {EDUCATION}
|
|
- Do not invent job title. If none is mentioned, return exactly: {CURRENT_TITLE}
|
|
|
|
linkedin_url (its own key — extract this separately from the other fields):
|
|
- Return the candidate's own public LinkedIn profile URL (linkedin.com/in/..., /pub/..., /mwlite/in/..., or lnkd.in/...).
|
|
- Reconstruct the URL if PDF extraction wrapped or spaced it (e.g. "linkedin.com/in/\\njane-doe" or "linkedin . com / in / jane-doe").
|
|
- Clickable icon links may appear as bare URLs on their own lines at the end of the text; use those.
|
|
- Do not return a company page (linkedin.com/company/...), a search URL, or a URL that is not LinkedIn.
|
|
- Do not invent a profile. If none is mentioned, return exactly: {NO_LINKEDIN}
|
|
|
|
Respond with JSON only:
|
|
{{
|
|
"current_employment": "Company Name",
|
|
"education": "Degree / School",
|
|
"current_title": "Job Title",
|
|
"linkedin_url": "https://www.linkedin.com/in/slug"
|
|
}}
|
|
"""
|
|
|
|
|
|
def user_prompt(resume_text:str) -> str:
|
|
return json.dumps({"resume_text":resume_text or ""},ensure_ascii=False)
|