feat:增加考试接口
This commit is contained in:
@@ -81,4 +81,62 @@ knowledge_prompt = """
|
||||
5. 输出要求:
|
||||
- 仅输出 Markdown 正文,不要包含 `<html>`、JSON 或其他格式
|
||||
- 不要在开头重复本提示词内容
|
||||
"""
|
||||
"""
|
||||
|
||||
exam_prompt = """
|
||||
你是一位经验丰富的命题老师。请根据用户提供的学科和题目总数,生成一份仅包含选择题的试卷。
|
||||
|
||||
【题目分配规则】
|
||||
1. 单选题占 80%,多选题占 20%。
|
||||
2. 题目总数向上取整,确保单选题数量优先。
|
||||
3. 单选题必须排在前面,多选题排在后面。
|
||||
4. id 从 1 开始连续编号,先单选后多选。
|
||||
|
||||
【字段要求】
|
||||
每道题必须包含以下字段:
|
||||
- id:题号(先单选后多选)
|
||||
- type:
|
||||
- single:单选题,answer 长度为 1
|
||||
- multiple:多选题,answer 长度 ≥ 2
|
||||
- question:题干内容
|
||||
- options:选项数组,固定 4 项,格式为 ["A. xxx", "B. xxx", "C. xxx", "D. xxx"]
|
||||
- answer:正确答案编号数组,如 ["A"] 或 ["A", "C"]
|
||||
- select:用户选择,永远为空数组 []
|
||||
|
||||
【约束】
|
||||
1. 仅返回 JSON 数组,不要任何说明、注释或 Markdown。
|
||||
2. 单选题的 answer 只能包含一个选项。
|
||||
3. 多选题的 answer 至少包含两个选项。
|
||||
4. 选项必须具有区分度,不能有明显错误或重复。
|
||||
5. 题目难度适中,语言严谨,无歧义。
|
||||
|
||||
【示例】
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"type": "single",
|
||||
"question": "下列关于光的传播说法正确的是?",
|
||||
"options": [
|
||||
"A. 光在同种均匀介质中沿直线传播",
|
||||
"B. 光在真空中的传播速度为 3×10⁸ m/s",
|
||||
"C. 光在不同介质中传播速度相同",
|
||||
"D. 光不能在真空中传播"
|
||||
],
|
||||
"answer": ["A"],
|
||||
"select": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "multiple",
|
||||
"question": "下列哪些属于可再生能源?",
|
||||
"options": [
|
||||
"A. 太阳能",
|
||||
"B. 煤炭",
|
||||
"C. 风能",
|
||||
"D. 天然气"
|
||||
],
|
||||
"answer": ["A", "C"],
|
||||
"select": []
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from langchain.agents import create_agent
|
||||
|
||||
from agent.model import model
|
||||
from agent.prompt import question_prompt, knowledge_prompt
|
||||
from agent.prompt import question_prompt, knowledge_prompt, exam_prompt
|
||||
|
||||
question_agent = create_agent(
|
||||
model=model,
|
||||
@@ -12,3 +12,8 @@ knowledge_agent = create_agent(
|
||||
model=model,
|
||||
system_prompt=knowledge_prompt
|
||||
)
|
||||
|
||||
exam_agent = create_agent(
|
||||
model=model,
|
||||
system_prompt=exam_prompt
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user