feat(exam): 出题批卷 API 增强 — 格式统一、校验、跨调用去重
- grader: 多策略 JSON 提取 + 3 次重试 + prompt 优化,修复 LLM 输出不稳定问题 - grader: question_content → content 统一字段名,与出题接口一致 - api: 新增入参校验(题型枚举、difficulty、总题数上限 20、grade question_type) - api/generator/manager: 新增 exclude_stems 参数,支持跨调用去重
This commit is contained in:
@@ -69,7 +69,8 @@ def generate_questions_from_file(
|
||||
question_types: Dict[str, int],
|
||||
difficulty: int = 3,
|
||||
options: Dict = None,
|
||||
request_id: str = None
|
||||
request_id: str = None,
|
||||
exclude_stems: List[str] = None
|
||||
) -> Dict:
|
||||
"""
|
||||
从文件生成题目(结构化出题 v2)
|
||||
@@ -88,6 +89,7 @@ def generate_questions_from_file(
|
||||
options: 可选配置
|
||||
- max_source_chunks: 最大切片数(默认 30)
|
||||
request_id: 请求 ID(幂等性支持)
|
||||
exclude_stems: 需要排除的已有题目题干列表(跨调用去重)
|
||||
|
||||
Returns:
|
||||
{
|
||||
@@ -115,7 +117,8 @@ def generate_questions_from_file(
|
||||
chunks=chunks,
|
||||
document_name=file_path,
|
||||
question_types=question_types,
|
||||
difficulty=difficulty
|
||||
difficulty=difficulty,
|
||||
exclude_stems=exclude_stems
|
||||
)
|
||||
|
||||
# 3. 统计实际出题数量,与请求数量对比
|
||||
|
||||
Reference in New Issue
Block a user