Spaces:
Sleeping
Sleeping
| # %%writefile core/matcher.py | |
| import json | |
| from openai import OpenAI | |
| from utils.prompts import JD_RESUME_MATCH_PROMPT | |
| import os | |
| client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) | |
| def match_candidate_to_jd(jd_rubric, candidate_profile): | |
| response = client.chat.completions.create( | |
| model="gpt-4o-mini", | |
| messages=[ | |
| { | |
| "role": "system", | |
| "content": JD_RESUME_MATCH_PROMPT | |
| }, | |
| { | |
| "role": "user", | |
| "content": f""" | |
| Job Description Rubric: | |
| {json.dumps(jd_rubric, indent=2)} | |
| Candidate Profile: | |
| {json.dumps(candidate_profile, indent=2)} | |
| """ | |
| } | |
| ], | |
| temperature=0.2 | |
| ) | |
| content = response.choices[0].message.content.strip() | |
| return json.loads(content) | |