响应生成如何在 RASA 核心中工作?

How Response Generation works in RASA core?

我对聊天机器人还很陌生,开始使用 RASA 作为框架。并且想知道 RASA 使用哪种方法作为他们的响应生成技术。 (NLG)

理论上,有两种 NLG 技术:

  1. 模板驱动的 NLG
  2. 高级 NLG - 神经网络和 ML

那么,在 RASA 中他们使用什么方法?

RASA 堆栈足够灵活,可以支持这两种用例。

您的问题的文档 (v: 0.10.3) 可在以下位置找到:http://www.rasa.com/docs/core/responses/

TL;DR

RASA 提供内置基于模板的 NLG。但是,它还允许您连接到 NLG 的 外部 HTTP 服务器。该服务器中发生的事情由您决定,它可以是基于神经网络的 NLG 服务器,但这需要您来完成。

模板驱动的 NLG

来自文档:

The default format is, to include the utterances into your domain file. This file then contains references to all your custom actions, available entities, slots and intents.

您的 domain 文件的一部分将包含 templates 部分。这是文档中的示例:

templates:
  utter_greet:
    - "hey there {name}!"    # variable will be filled by slot with the same name or by custom code
  utter_goodbye:
    - "goodbye "
    - "bye bye "              # multiple templates will allow the bot to randomly pick from them
  utter_default:
    - "default message"

高级 NLG - 神经网络和 ML

来自文档:

Retraining the bot, just to change the text copy can be suboptimal for some workflows. That’s why Core also allows you to outsource the response generation and separate it from the dialogue learning.

The bot will still learn to predict actions and to react to user input based on past dialogues, but the responses it sends back to the user are generated outside of Rasa Core.

If the bot wants to send a message to the user, it will call an external HTTP server with a POST request. To configure this endpoint, you need to create an endpoints.yml and pass it either to the run or server script.

核心将使用对话中的信息联系您的服务器,包括用户话语、意图和填充的槽位。然后,您的服务器将拥有基于神经网络的 NLG(由您开发),它将 return 机器人应向用户显示的文本。