基于意图的大模型对话系统

该功能出现在rasa-plus中。

基于意图大模型的对话系统,大模型扮演3个核心功能:

  • 基于prompt的意图分类
  • 无意图策略
  • NLG的rephrase

使用大模型做意图分类

意图和意图样例一起放入prompt

不建议将全部意图放入prompt,这样会让prompt太长,也会导致无法加入意图对应的样例。

如果不加入意图对应的样例,大模型只能根据意图的名字判断,可能无法预测出正常的意图。

只放入会用到的意图及其样例。

预测的意图不在领域意图内

当大模型预测的意图不在domain的全部意图内时,找到一个最接近的领域意图返回。

和输入最相似的样例放入prompt

通过向量搜索,找到和输入最相似的样例,放入prompt

Label a users message from a
conversation with an intent. Reply ONLY with the name of the intent.

The intent should be one of the following:
{% for intent in intents %}- {{intent}}
{% endfor %}
{% for example in examples %}
Message: {{example['text']}}
Intent: {{example['intent']}}
{% endfor %}
Message: {{message}}
Intent:

无意图的大模型策略

为什么基于意图的设计是有缺陷的?

因为单句在很多时候无法匹配意图,必须考虑上文。

无意图策略的触发逻辑是怎样的?


如何解决幻觉?

大模型不直接生成文本,而是从领域文件里选择response进行输出。

和以前的方案有什么区别?

  • 故事不再需要那么多,只需要少量的故事放入prompt
  • 不再需要Entities
  • 无法支持自定义动作,只能说话
基于大模型的NLG

虽然大模型从领域文件里选择response输出,但是会rephrase,让输出不那么呆板。

同时,会结合上文context进行rephrase,交互更人性化。

(注意:rephrase后,用户行为可能因此改变,因此,需要观察用户体验)

用于rephrase的prompt类似:

The following is a conversation with
an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Rephrase the suggest AI response staying close to the original message and retaining
its meaning. Use simple english.
Context / previous conversation with the user:
{{history}}
{{current_input}}
Suggested AI Response: {{suggested_response}}
Rephrased AI Response:

  • 11
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值