triage/test_prompter.py

49 lines
1.4 KiB
Python
Raw Normal View History

#!/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()