triage/test_prompter.py
iomgaa 2e0f9145c6 新增:添加Prompter智能体模块
- 实现智能体提示词生成专家功能
- 基于患者病史和具体任务生成定制化子智能体
- 包含专业角色定义和可操作询问指令生成
- 添加完整的测试用例验证功能

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 16:06:52 +08:00

49 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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