Files
rag/docs/题目模板.md
lacerate551 100d1a06eb init: RAG 知识库服务初始提交
- 后端 API(Flask + Gunicorn)
- RAG 引擎(混合检索 + 云端 Reranker + 引用溯源)
- 文档解析(MinerU + 多格式支持)
- Docker 生产部署配置
- 排除前端项目、敏感配置、模型文件
2026-06-04 17:35:27 +08:00

80 lines
3.9 KiB
Markdown
Raw 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.
1. 整体结构 (Envelope Pattern)所有题型统一采用以下外壳,通过 question_type 进行区分。JSON{
"metadata": {
"question_id": "string (UUID)",
"question_type": "single_choice | multiple_choice | true_false | fill_blank | subjective",
"difficulty": 3,
"tags": ["知识点A", "知识点B"],
"score": 10.0,
"version": "1.0"
},
"source_trace": {
"document_id": "string - 原始文档ID",
"document_name": "string - 文档名称",
"source_context": "string - AI出题参考的原文切片/上下文",
"page_numbers": [14, 15]
},
"content": {
"stem": "string - 题干内容支持Markdown格式",
"data": {},
"answer": null,
"explanation": "string - 详尽的答案解析"
},
"review_info": {
"status": "pending",
"reviewer_comment": null,
"created_at": "2026-04-17T18:30:00Z"
}
}
2. 各题型 content.data 与 content.answer 定义(1) 单选题 (single_choice)data: 包含选项数组。answer: 对应正确选项的 key。JSON"content": {
"stem": "根据文档,公司成立的年份是?",
"data": {
"options": [
{"key": "A", "content": "1998年"},
{"key": "B", "content": "2005年"},
{"key": "C", "content": "2010年"}
]
},
"answer": "B",
"explanation": "在文档第三页明确提到公司于2005年获得营业执照。"
}
(2) 多选题 (multiple_choice)data: 选项数组。answer: 正确选项 key 的数组。JSON"content": {
"stem": "以下属于公司核心价值观的有?",
"data": {
"options": [
{"key": "A", "content": "创新"},
{"key": "B", "content": "诚信"},
{"key": "C", "content": "加班"}
]
},
"answer": ["A", "B"],
"explanation": "手册第一章第一节列出了‘创新’与‘诚信’为唯二核心价值观。"
}
(3) 判断题 (true_false)data: 可留空或自定义文字(如:正确/错误,对/错。answer: boolean (true 为正确false 为错误)。JSON"content": {
"stem": "员工可以在办公区吸烟。",
"data": null,
"answer": false,
"explanation": "《行政管理规范》第五条严禁在办公区吸烟。"
}
(4) 填空题 (fill_blank)data: 槽位定义。answer: 数组按顺序存放每个空的标准答案列表支持同义词。JSON"content": {
"stem": "RAG的全称是___其核心在于利用___增强生成效果。",
"data": { "blank_count": 2 },
"answer": [
["检索增强生成", "Retrieval Augmented Generation"],
["外部知识库", "自有文档", "Context"]
],
"explanation": "RAG即检索增强生成通过引入外部知识库信息提升回答准确度。"
}
(5) 主观题 (subjective)data: 包含评分维度和关键词。answer: string (参考范文)。JSON"content": {
"stem": "请简述RAG架构中切片策略对检索质量的影响。",
"data": {
"scoring_points": [
{"point": "提到了语义完整性", "weight": 0.4},
{"point": "提到了切片过大导致噪声", "weight": 0.3},
{"point": "提到了切片过小丢失上下文", "weight": 0.3}
],
"keywords": ["语义窗口", "Top-K", "重叠度"]
},
"answer": "参考范文合理的切片策略能保持语义完整通过设置Overlap防止信息断层...",
"explanation": "此题考查对RAG性能优化的深度理解。"
}
3. 后端约束说明 (Tips for Backend)数据持久化:建议将 content 整体以 JSONB (PostgreSQL) 或类似的格式存储,方便扩展未来可能增加的题型(如连线题、排序题)。分值校验:后端应校验 metadata.score 是否为正数;对于多选题,可增加逻辑判断 answer 数组长度必须 $\ge 2$。RAG 闭环source_trace 字段是 RAG 项目的核心,建议后端在审核界面提供一个“点击查看原文”的按钮,直接展示 source_context 的内容。幂等性:建议由前端或 AI 服务生成 question_id (UUID),防止网络波动导致的重复入库。