RasaHost
1.0.0
Rasa NLU 和 Rasa Core 的用户界面,可简化机器人开发。
https://pypi.org/project/rasa-host
pip install rasa - host
Rasa-Host 不依赖于 Rasa(实际上不依赖于 Rasa 包)并且适用于所有版本。
from rasa_core . interpreter import RasaNLUInterpreter
from rasa_core . agent import Agent
interpreter = RasaNLUInterpreter ( 'models/current/nlu' )
agent = Agent . load ( "models/current/dialogue" , interpreter = interpreter )
from RasaHost import host
host . nlu_path = os . path . join ( current_dir , "data/nlu/" )
host . stories_path = os . path . join ( current_dir , "data/stories/" )
host . domain_path = os . path . join ( current_dir , "data/domain.yml" )
host . agent = agent
if __name__ == '__main__' :
host . run ()
# werkzeug - * Running on http://0.0.0.0:5005/ (Press CTRL+C to quit)
# GET http://localhost:5005/conversations/daniel/respond?q={{message}}
from RasaHost import host
host . nlu_path = os . path . join ( current_dir , "data/nlu/" )
if __name__ == '__main__' :
host . run ()
from RasaHost import host
host . stories_path = os . path . join ( current_dir , "data/stories/" )
if __name__ == '__main__' :
host . run ()
from RasaHost import host
host . domain_path = os . path . join ( current_dir , "data/domain.yml" )
if __name__ == '__main__' :
host . run ()
用于测试 Rasa 的聊天界面。默认情况下,GET http://{{host}}/conversations/{{sender_id}}/respond?q={{message}}
from RasaHost import host
host . agent = agent
if __name__ == '__main__' :
host . run ()
对话保存在 SQLite 中。
from RasaHost import host
host . agent = agent
if __name__ == '__main__' :
host . run ()
日志保存在 SQLite 中。
from RasaHost import host
host . agent = agent
if __name__ == '__main__' :
host . run ()
分析意图、故事和领域。显示警告和建议。
from RasaHost import host
host . nlu_path = os . path . join ( current_dir , "data/nlu/" )
host . stories_path = os . path . join ( current_dir , "data/stories/" )
host . domain_path = os . path . join ( current_dir , "data/domain.yml" )
if __name__ == '__main__' :
host . run ()
解码记忆策略数据。
from RasaHost import host
host . memoization_policy_path = os . path . join ( current_dir , "modelscurrentdialoguepolicy_1_MemoizationPolicy" )
if __name__ == '__main__' :
host . run ()
您还可以在有或没有代理的情况下托管操作。
from rasa_core_sdk . executor import ActionExecutor
actionExecutor = ActionExecutor ()
actionExecutor . register_package ( 'actions' )
from RasaHost import host
host . actionExecutor = actionExecutor
if __name__ == '__main__' :
host . run ()
# werkzeug - * Running on http://0.0.0.0:5005/ (Press CTRL+C to quit)
# POST http://localhost:5005/actions
使用代理和自定义操作运行应用程序的示例。
from rasa_core . interpreter import RasaNLUInterpreter
from rasa_core . agent import Agent
from rasa_core import utils , server
from rasa_core_sdk . executor import ActionExecutor
# #rasa-host.endpoints.yml
# action_endpoint:
# url: "http://localhost:5005/actions"
action_endpoint_conf = utils . read_endpoint_config ( "rasa-host.endpoints.yml" , endpoint_type = "action_endpoint" )
interpreter = RasaNLUInterpreter ( 'models/current/nlu' )
agent = Agent . load ( "models/current/dialogue" , interpreter = interpreter , action_endpoint = action_endpoint_conf )
actionExecutor = ActionExecutor ()
actionExecutor . register_package ( 'actions' )
from RasaHost import host
host . nlu_path = os . path . join ( current_dir , "data/nlu/" )
host . stories_path = os . path . join ( current_dir , "data/stories/" )
host . domain_path = os . path . join ( current_dir , "data/domain.yml" )
host . agent = agent
host . actionExecutor = actionExecutor
if __name__ == '__main__' :
host . run ()
# werkzeug - * Running on http://0.0.0.0:5005/ (Press CTRL+C to quit)
# GET http://localhost:5005/conversations/daniel/respond?q={{message}}
# POST http://localhost:5005/actions
支持渠道。所有对话都将被记录。
from rasa_core . channels . botframework import BotFrameworkInput
input_channel = BotFrameworkInput (
app_id = "" ,
app_password = ""
)
from RasaHost import host
host . agent = agent
host . channels = [ input_channel ]
if __name__ == '__main__' :
host . run ()