HR-ATS-Portal/backend/agent/prompt.py

40 lines
1.0 KiB
Python

"""Agent prompt builders.
Pure module: no FastAPI imports and no HTTPException.
"""
from __future__ import annotations
import json
def prompt():
return """You are an HR-ATS recruiting assistant.
Given a candidate email subject, resume text, and a list of active job posts,
identify which job posts the candidate is most likely applying for.
Return JSON only with this shape:
{
"suggested_job_post_ids": ["uuid-string", ...],
"reasoning": "brief explanation"
}
Rules:
- suggested_job_post_ids must only contain ids from the provided job_posts list.
- Return an empty list when nothing matches confidently.
- A candidate may match zero, one, or multiple posts.
- Prefer title/subject alignment, then skills and experience in the resume.
"""
def user_prompt(state) -> str:
return json.dumps(
{
"subject": state.get("subject") or "",
"resume_text": state.get("resume_text") or "",
"job_posts": state.get("job_posts") or [],
},
ensure_ascii=False,
)