iomgaa 89c82d2031 新增:添加Inquirer询问者智能体模块
主要特性:
- 基于Prompter动态生成的描述和指令构建智能体
- 在初始化时接收description和instructions参数
- 将Prompter生成的指令与固定的输入输出格式要求拼接
- 简洁的run方法,与其他agent保持一致的调用方式
- 支持根据患者现病史和既往史生成针对性问诊问题

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

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

53 lines
1.8 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.

from agent_system.base import BasePrompt
class InquirerPrompt(BasePrompt):
"""
询问者智能体的提示词模板
该提示词模板的description和instructions主体内容由Prompter智能体动态生成
只在末尾添加固定的输入信息和输出格式要求。
"""
# 基础描述将被prompter结果动态替换
description = ""
# 基础指令将被prompter结果动态替换
instructions = []
@staticmethod
def get_example_output() -> str:
"""
获取示例输出格式,用于指导 LLM 生成符合要求的结构化输出
Returns:
str: JSON 格式的示例输出
"""
return """{
"current_chat": "根据您描述的头痛情况,我想进一步了解一些细节。请问您的头痛是什么时候开始的?是突然出现还是逐渐加重的?另外,头痛主要集中在头部的哪个位置?"
}"""
@staticmethod
def get_fixed_format_instructions() -> list:
"""
获取固定的输入输出格式指令
Returns:
list: 固定的格式指令列表
"""
return [
"",
"## 患者信息输入格式",
"- 现病史: 患者当前疾病的详细描述",
"- 既往史: 患者过往的疾病史和治疗史",
"",
"## 输出要求",
"生成的问诊问题应该:",
"1. 针对患者的具体病情背景",
"2. 使用通俗易懂的语言表达",
"3. 有助于获取更多诊断相关信息",
"4. 符合医患交流的实际情况",
"",
"## 示例输出格式JSON",
InquirerPrompt.get_example_output()
]