首页 > 解决方案 > 谷歌 colab/jupyter 笔记本上的 Rasa 自定义操作不适用于聊天(模型路径,端点)?

问题描述

我想在 Google colab 上同时运行 Rasa shell 和 Rasa 自定义操作服务器。这是我的设置和部分代码。

endpoints.yml中。

action_endpoint:
  url: "http://localhost:5055/webhook"

动作.py

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher

class ActionHelloWorld(Action):

     def name(self) -> Text:
         return "action_hello_world"

     def run(self, dispatcher: CollectingDispatcher,
             tracker: Tracker,
             domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

         dispatcher.utter_message(text="Hello World from action!")

         return []

使用nohup在后台运行 Action 服务器后。

!nohup /usr/bin/python3 -m rasa_sdk.endpoint --actions actions &

我使用以下方法训练了 Rasa 模型:

model_path = rasa.train(domain, config, [training_files] , output)

然后,我使用以下命令在 colab 单元中运行 Rasa shell:

from rasa.jupyter import chat

endpoints = "endpoints.yml"

chat(model_path, endpoints)

此方法不知何故无法与 Rasa 操作服务器连接,它适用于非操作回复。它只是不适用于获取自定义回复。

但如果我使用!rasa shell --endpoints endpoints.yml. 可以看到这两个部分在交互,但如果chat(model_path, endpoints)使用它们就不会?

标签: pythongoogle-colaboratoryrasarasa-nlurasa-core

解决方案


推荐阅读