python - 谷歌 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)
使用它们就不会?
解决方案
推荐阅读
- spring-security - 如何更改 Spring Security SAML 的默认 SP SSO URL?
- data-mining - 相异矩阵计算
- c++ - 具有多重继承的单例
- python - 带有“使用”装饰器的 peewee 多数据库
- python - 不支持的操作数
- python - 使用 https 请求 django API 不起作用
- angular - Angular 12 - 出现错误'source.subscribe 不是函数'
- javascript - 如何将 HTML 应用程序转换为 PDF 并将其作为 multipart/form-data 发送到 Ajax POST 调用
- c++ - 半条命 SDK dll
- powershell - 如何通过powershell提取csv中多列中的单个单元格值