Files
RoyirinRosmontis a10442d78c CareerNexus 职联:岗位能力图谱构建与动态演化分析平台(挑战杯 XH-202621)
- 全链路:多源JD接入/清洗交叉验证/结构化抽取(星火+离线双通道)/时序知识图谱/新岗位发现/演化分析/人岗匹配/学习路径
- WebUI 五视图:驾驶舱/图谱工作台/岗位演化/匹配(单人+批量)/学习路径
- 设置中心(config.json)/Token鉴权/SQLite状态库/语义向量通道(BGE-M3本地或联网API)
- 71 个 pytest 用例;数据目录仅保留结构(.gitkeep),数据由 scripts/generate_dataset.py 复现
2026-08-03 13:15:35 +08:00

44 lines
2.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""大模型抽取的固化提示词模板与输出 Schema。
prompt_version 是抽取结果血缘的一部分:提示词变更必须升版本号,
评测与图谱中都能据此追溯。
"""
PROMPT_VERSION = "spark-jd-v1.1"
SYSTEM_PROMPT = (
"你是招聘信息结构化专家。请从招聘 JD 文本中抽取岗位定义,"
"只输出符合给定 JSON Schema 的 JSON,不要输出任何多余文字。"
"技能名必须归一化到常见写法(如 LLM应用开发 归一化为 大模型应用开发),"
"每个字段都要给出原文证据片段,不得编造原文没有的内容。"
)
# 输出 Schema(JSON Schema 强校验的目标结构,与 ExtractionResult 对齐)
OUTPUT_SCHEMA: dict = {
"type": "object",
"required": ["job_title", "responsibilities", "required_skills", "preferred_skills", "scenarios"],
"properties": {
"job_title": {"type": "string", "description": "岗位标准名称"},
"responsibilities": {"type": "array", "items": {"type": "string"}, "description": "核心职责"},
"required_skills": {"type": "array", "items": {"type": "string"}, "description": "必备技能"},
"preferred_skills": {"type": "array", "items": {"type": "string"}, "description": "加分技能"},
"scenarios": {"type": "array", "items": {"type": "string"}, "description": "应用场景"},
"evidence": {"type": "object", "description": "字段名 -> 原文证据片段"},
},
}
def build_prompt(jd_text: str) -> str:
"""拼接待抽取 JD 的用户提示词(含显式 Schema,字段名必须为英文键)。"""
return (
"请从以下招聘 JD 文本中抽取结构化岗位定义。\n"
"要求:\n"
"1. 只输出一个 JSON 对象,不要 markdown 代码块,不要任何解释文字;\n"
"2. 字段名必须使用以下英文键:job_title(岗位标准名称)、responsibilities(核心职责,字符串数组)、"
"required_skills(必备技能,字符串数组)、preferred_skills(加分/优先技能,字符串数组)、"
"scenarios(应用场景,字符串数组)、evidence(对象,键为字段名,值为原文证据片段);\n"
"3. 技能名归一化到常见写法(如 LLM应用开发→大模型应用开发);\n"
"4. 不得编造原文没有的内容。\n\n"
"JD 文本:\n" + jd_text
)