- 重新设计prompt中的分诊分析步骤,明确四个步骤的顺序 - 将triage_reasoning字段调整到最前面,体现分析优先的原则 - 更新示例输出格式,确保字段顺序一致 - 修改fallback结果的字段顺序以匹配新的模型结构 - 经测试验证,字段顺序正确且分诊逻辑清晰 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
944 B
Python
34 lines
944 B
Python
from typing import Literal
|
||
from pydantic import Field
|
||
from agent_system.base import BaseResponseModel
|
||
|
||
|
||
class TriageResult(BaseResponseModel):
|
||
"""
|
||
科室分诊结果模型
|
||
"""
|
||
triage_reasoning: str = Field(
|
||
...,
|
||
description="分诊推理过程,解释为什么推荐该科室"
|
||
)
|
||
|
||
primary_department: Literal[
|
||
"内科", "外科", "儿科", "妇产科", "皮肤性病科",
|
||
"口腔科", "眼科", "肿瘤科", "耳鼻咽喉科", "康复科",
|
||
"精神科", "全科", "体检科"
|
||
] = Field(
|
||
...,
|
||
description="一级科室,必须从指定的科室列表中选择"
|
||
)
|
||
|
||
secondary_department: str = Field(
|
||
...,
|
||
description="二级科室,必须是一级科室的下属科室"
|
||
)
|
||
|
||
confidence_score: float = Field(
|
||
...,
|
||
ge=0.0,
|
||
le=1.0,
|
||
description="分诊信心度评分(0-1之间)"
|
||
) |