- 实现智能体提示词生成专家功能 - 基于患者病史和具体任务生成定制化子智能体 - 包含专业角色定义和可操作询问指令生成 - 添加完整的测试用例验证功能 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
测试Prompter智能体功能
|
||
"""
|
||
|
||
from agent_system.prompter import Prompter
|
||
|
||
def test_prompter():
|
||
"""测试Prompter智能体的基本功能"""
|
||
|
||
# 创建Prompter实例
|
||
prompter = Prompter()
|
||
|
||
# 测试数据
|
||
hpi_content = "患者反复头痛3个月,以前额和颞部为主,呈搏动性疼痛,每周发作2-3次,每次持续4-6小时"
|
||
ph_content = "既往体健,无高血压、糖尿病等慢性疾病史,无头部外伤史"
|
||
chief_complaint = "反复头痛3个月"
|
||
current_task = "起病情况和患病时间"
|
||
|
||
print("=== 测试Prompter智能体 ===")
|
||
print(f"患者主述: {chief_complaint}")
|
||
print(f"现病史: {hpi_content}")
|
||
print(f"既往史: {ph_content}")
|
||
print(f"当前任务: {current_task}")
|
||
print()
|
||
|
||
try:
|
||
# 执行Prompter分析
|
||
result = prompter.run(
|
||
hpi_content=hpi_content,
|
||
ph_content=ph_content,
|
||
chief_complaint=chief_complaint,
|
||
current_task=current_task
|
||
)
|
||
|
||
print("=== Prompter分析结果 ===")
|
||
print(f"子智能体描述:")
|
||
print(f"{result.description}")
|
||
print()
|
||
print(f"子智能体指令:")
|
||
for i, instruction in enumerate(result.instructions, 1):
|
||
print(f"{i}. {instruction}")
|
||
print()
|
||
|
||
except Exception as e:
|
||
print(f"测试失败: {e}")
|
||
|
||
if __name__ == "__main__":
|
||
test_prompter() |