HumanPersonaBase:一种语言无关的类人 AI 通信框架
I’m happy to translate the article for you, but I’ll need the article’s text (the content you’d like translated) in order to do so. Could you please paste the article’s body here? Once I have the text, I’ll provide a Simplified‑Chinese translation while keeping the source line, formatting, markdown, and any code blocks unchanged.
问题:AI 听起来像 AI
GPT‑4.5,在给出类人角色时,被 73 % 的评估者 认定为人类——超过了实际人类的识别率(Jones & Bergen, 2024, PNAS)。
人类般 AI 的瓶颈已经转移。语义理解已经解决。现在让 AI 暴露的,是 它的交流方式:
- 即时回复 — 人类不会在 2 秒内作出回应
- 语调统一 — 每次都使用同样的精致风格
- 情感平淡 — 对话中缺乏情感起伏
- 无记忆 — 从不引用之前说过的话
- 过于完美 — “我将在恰好 3 天内完成” 听起来像机器人
这些是 副语言特征 —— 与语言理解分离的另一层。
解决方案:行为基类
我构建了 human‑persona,一个开源的 Python 框架,为类人 AI 通信提供行为层。它不生成文本——它告诉你的 LLM 何时回复,使用何种语气,传达何种情绪状态,以及 何时转交给人工。
该框架将类人行为分解为五个正交组件:
1. TimingController
使用高斯分布的响应延迟,而非均匀随机。平台感知:聊天(30‑180 秒),电子邮件(1‑8 小时)。夜间排队防止凌晨 3 点回复。
def calculate_delay(self, platform: Platform) -> float:
profile = self.profiles[platform]
midpoint = (profile.min_seconds + profile.max_seconds) / 2
spread = (profile.max_seconds - profile.min_seconds) / 4
return clamp(
random.gauss(midpoint, spread),
profile.min_seconds,
profile.max_seconds,
)
2. EmotionStateMachine
一个 5 状态的有限状态机(FSM),模拟职业关系的情感轨迹:
FORMAL → WARMING → TENSE → RELIEVED → TRUSTED
转换使用 Callable[[EmotionStateMachine], bool] —— 不依赖脆弱的字符串解析:
Transition(FORMAL, WARMING,
lambda sm: sm.exchange_count >= 3)
Transition(WARMING, TENSE,
lambda sm: sm._last_event == "problem_detected")
3. StyleVariator
在五种模式(确认、共情、推迟、转接、不确定)之间轮换,采用基于历史的加权选择。防止相同模式重复。概率性地插入不确定表达——“大约 3 天左右”胜过“恰好 3 天”。
4. ContextReferencer
基于主题的对话跟踪。能够判断何时添加“正如您之前提到的……”式的回溯引用。
5. EscalationDetector
基于关键词的人类转接,带有优先级排序。自动链入情感状态机——检测到投诉时情绪转为 TENSE。
设计原则:文化无关的基类
基类不包含任何语言或文化。所有具体细节通过 JSON 配置注入:
{
"name": "JapaneseBusiness",
"language": "ja",
"culture": {
"context_level": 0.8,
"formality_default": 0.7
},
"style": {
"uncertainty_rate": 0.2,
"style_patterns": [
{
"type": "confirmation",
"templates": ["...ということですよね?"]
}
]
}
}
这遵循 Hall(1976)提出的高/低语境文化框架。日本商务角色(高语境、间接)和英语客服代理(低语境、直接)使用相同的基类,只是参数不同。
快速入门
from core.base_persona import HumanPersonaBase
persona = HumanPersonaBase.from_config_file("config/ja_business.json")
response = persona.process_message("Can we discuss the deadline?")
print(response.delay_seconds) # 45.2 (not instant)
print(response.emotion_state) # EmotionState.WARMING
print(response.style_used) # StyleType.CONFIRMATION
# Inject into your LLM system prompt
context = persona.get_system_prompt_context()
接下来
- 评估实验(自动图灵测试方法)
- arXiv 论文:“HumanPersonaBase: A Language‑Agnostic Framework for Human‑like AI Communication in Professional Contexts”
- 社区驱动的派生角色用于更多语言
链接
- GitHub:
- 许可证: MIT
- 伦理: 包含完整指南 —— 明确禁止欺诈、冒充和选举干预
欢迎贡献 —— 尤其是针对日语和英语之外语言的衍生角色。请提交 issue 或 PR。