Spaces:
Sleeping
Sleeping
| import json | |
| from pathlib import Path | |
| from typing import List, Dict, Any | |
| from crewai.tools import tool | |
| from core.jd_processor import generate_jd_rubric | |
| from core.resume_parser import parse_resume | |
| from core.matcher import match_candidate_to_jd | |
| from core.ranking import build_ranking | |
| from utils.file_loader import load_text_from_file | |
| def generate_jd_rubric_tool(jd_text: str) -> str: | |
| """Generate a structured JD rubric JSON (string) from JD text.""" | |
| rubric = generate_jd_rubric(jd_text) | |
| return json.dumps(rubric, ensure_ascii=False) | |
| def parse_resume_tool(resume_text: str, filename: str) -> str: | |
| """Parse a resume into candidate JSON (string) from resume text.""" | |
| candidate = parse_resume(resume_text, filename) | |
| return json.dumps(candidate, ensure_ascii=False) | |
| def match_candidate_tool(jd_rubric_json: str, candidate_json: str) -> str: | |
| """Match a candidate against JD rubric; returns match JSON (string).""" | |
| jd_rubric = json.loads(jd_rubric_json) | |
| candidate = json.loads(candidate_json) | |
| match_result = match_candidate_to_jd(jd_rubric, candidate) | |
| return json.dumps(match_result, ensure_ascii=False) | |
| def build_ranking_tool(top_k: int) -> str: | |
| """Build ranking from data/matches; returns ranking JSON (string).""" | |
| ranking = build_ranking(top_k=int(top_k)) | |
| return json.dumps(ranking, ensure_ascii=False) | |