天天看点

Rasa 文档 中英文翻译版本 4 - User Guide: Command Line InterfaceRasa 文档 中英文翻译版本 4 - User Guide: Command Line Interfacehttps://rasa.com/docs/rasa/user-guide/command-line-interface/ Command Line Interface 命令行接口

Rasa 文档 中英文翻译版本 4 - User Guide: Command Line Interface

https://rasa.com/docs/rasa/user-guide/command-line-interface/

T by yi 2020.9.15

Command Line Interface 命令行接口

Cheat Sheet 

Create a new project

Train a Model

Interactive Learning

Talk to your Assistant

Start a Server

Start an Action Server

Visualize your Stories

Evaluating a Model on Test Data

Create a Train-Test Split

Convert Data Between Markdown and JSON

Export Conversations to an Event Broker

Start Rasa X

备忘单

创建新项目

训练模型

互动学习

与您的助手交谈

启动服务器

启动操作服务器

可视化故事

测试数据评估模型

创建训练-测试拆分

在Markdown 和 JSON 之间转换数据

将对话导出到事件代理

Cheat Sheet 备忘单

The command line interface (CLI) gives you easy-to-remember commands for common tasks.

CLI让你能够便捷的记忆通用任务的命令

Command Effect
rasa init

Creates a new project with example training data, actions, and config files.

初始化一个项目,包含示例训练数据、动作和配置文件

rasa train

Trains a model using your NLU data and stories, saves trained model in ./models.

用NLU数据和stories训练一个模型,保存在./models.

rasa interactive

Starts an interactive learning session to create new training data by chatting.

启动交互式学习会话,通过聊天创建新的训练数据。

rasa shell

Loads your trained model and lets you talk to your assistant on the command line.

加载训练的模型,并允许您在命令行上与助手交谈。

rasa run

Starts a Rasa server with your trained model. See the Configuring the HTTP API docs for details.

启动Rasa服务. 参看 Configuring the HTTP API 

rasa run actions

Starts an action server using the Rasa SDK.

使用 Rasa SDK 启动操作服务器。

rasa visualize

Visualizes stories.

可视化stories

rasa test

Tests a trained Rasa model using your test NLU data and stories.

训练模型

rasa data split nlu

Performs a split of your NLU data according to the specified percentages.

根据指定的百分比执行 NLU 数据的拆分。

rasa data convert nlu

Converts NLU training data between different formats.

在不同格式之间转换 NLU 训练数据。

rasa export

Export conversations from a tracker store to an event broker.

将对话从跟踪器存储导出到事件代理。

rasa x

Launch Rasa X locally.

本地启动Rasa X

rasa -h

Shows all available commands.

显示所有的可用命令

Create a new project 新建项目

A single command sets up a complete project for you with some example training data.

使用单个命令生成包含一些示例训练数据的一个完整的项目。

rasa init

This creates the following files:

自动生成下面的文件

.

├── __init__.py

├── actions.py

├── config.yml

├── credentials.yml

├── data

│   ├── nlu.md

│   └── stories.md

├── domain.yml

├── endpoints.yml

└── models

    └── <timestamp>.tar.gz

The rasa init command will ask you if you want to train an initial model using this data. If you answer no, the models directory will be empty.

rasa init 命令将询问您是否要使用此数据训练初始模型。如果回答"否",则模型目录将为空。

With this project setup, common commands are very easy to remember. To train a model, type rasa train, to talk to your model on the command line, rasa shell, to test your model type rasa test.

通过此项目设置,常见命令很容易记住。键入 rasa train训练模型,键入 rasa shell 与模型交谈。键入 rasa test测试模型。

Train a Model 训练模型

The main command is:

rasa train

This command trains a Rasa model that combines a Rasa NLU and a Rasa Core model. If you only want to train an NLU or a Core model, you can run rasa train nlu or rasa train core. However, Rasa will automatically skip training Core or NLU if the training data and config haven’t changed.

此命令训练结合 Rasa NLU 和 Rasa Core 模型的 Rasa 模型。如果您只想训练 NLU 或核心模型,您可以运行 rasa train  nlu 或 rasa train core。但是,如果训练数据和配置没有更改,Rasa 将自动跳过训练核心或 NLU。

rasa train will store the trained model in the directory defined by --out. The name of the model is per default <timestamp>.tar.gz. If you want to name your model differently, you can specify the name using --fixed-model-name.

rasa train 将把训练后的模型存储在 --out定义的目录中。模型的名称是默认的 <timestamp>.tar.gz。如果要以不同的方式命名模型,可以使用 --fixed-model-name指定名称。

The following arguments can be used to configure the training process:

以下参数可用于配置培训过程:

usage: rasa train [-h] [-v] [-vv] [--quiet] [--data DATA [DATA ...]]

                  [-c CONFIG] [-d DOMAIN] [--out OUT]

                  [--augmentation AUGMENTATION] [--debug-plots]

                  [--fixed-model-name FIXED_MODEL_NAME] [--persist-nlu-data]

                  [--force]

                  {core,nlu} ...

positional arguments:  位置参数

  {core,nlu}

core                Trains a Rasa Core model using your stories.

训练Rasa Core

nlu                 Trains a Rasa NLU model using your NLU data.

训练Rasa NLU

optional arguments:  可选参数

  -h, --help            show this help message and exit

显示帮助消息和退出

  --data DATA [DATA ...]

                        Paths to the Core and NLU data files. (default:

                        ['data'])

定义Core和NLU数据文件位置,默认在['data']

  -c CONFIG, --config CONFIG

                        The policy and NLU pipeline configuration of your bot.

                        (default: config.yml)

定义你的机器人的策略和NLU通道配置,默认在config.yml

  -d DOMAIN, --domain DOMAIN

                        Domain specification (yml file). (default: domain.yml)

制定域文件,默认domain.yml

  --out OUT             Directory where your models should be stored.

                        (default: models)

制定训练模型输出目录,默认models

  --augmentation AUGMENTATION

                        How much data augmentation to use during training.

                        (default: 50)

定义训练过程中使用的数据参数数量,默认50

  --debug-plots         If enabled, will create plots showing checkpoints and

                        their connections between story blocks in a file

                        called `story_blocks_connections.html`. (default:

                        False)

如果启用,将创建显示检查点和

                  它们在文件中的故事块之间的连接定义文件

                         "story_blocks_connections. html" 。(默认:

                        False)  

  --persist-nlu-data    Persist the nlu training data in the saved model.

                        (default: False)

在输出保存模型中实例化NLU训练数据,默认False

  --force               Force a model training even if the data has not

                        changed. (default: False)

强制在没有数据变化的情况下训练

Python Logging Options:  Python日志选项

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

详细记录。将日志级别设置为INFO

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

打印debug状态。设置日志级别为debug

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

安静记录。设置日志级别为WARNING

Note

Make sure training data for Core and NLU are present when training a model using rasa train. If training data for only one model type is present, the command automatically falls back to rasa train nlu or rasa train core depending on the provided training files.

使用 rasa train训练模型时,请确认 Core 和 NLU 两个训练数据同时存在。如果仅存在一个模型类型的训练数据,则命令会根据所提供的训练文件自动回退到rasa train nl 或 rasa train core。

Interactive Learning 互动学习

To start an interactive learning session with your assistant, run

要与助手开始交互式学习会话,请运行

rasa interactive

If you provide a trained model using the --model argument, the interactive learning process is started with the provided model. If no model is specified, rasa interactive will train a new Rasa model with the data located in data/ if no other directory was passed to the --data flag. After training the initial model, the interactive learning session starts. Training will be skipped if the training data and config haven’t changed.

如果使用--model 参数提供训练模型,则交互式学习过程将启动所提供的模型。如果未指定模型,也没有定义--data标签,rasa interactive将用data/下数据训练新的 Rasa 模型 。训练初始模型后,开始交互式学习会话。如果训练数据和配置尚未更改将跳过训练。

The full list of arguments that can be set for rasa interactive is:

可为 rasa 交互对话设置的参数的完整列表是:

usage: rasa interactive [-h] [-v] [-vv] [--quiet] [--e2e] [-m MODEL]

                        [--data DATA [DATA ...]] [--skip-visualization]

                        [--conversation-id CONVERSATION_ID]

                        [--endpoints ENDPOINTS] [-c CONFIG] [-d DOMAIN]

                        [--out OUT] [--augmentation AUGMENTATION]

                        [--debug-plots] [--force] [--persist-nlu-data]

                        {core} ... [model-as-positional-argument]

positional arguments: 

  {core}

    core                Starts an interactive learning session model to create

                        new training data for a Rasa Core model by chatting.

                        Uses the 'RegexInterpreter', i.e. `/<intent>` input

                        format.

启动要创建交互式学习会话模型

                        通过聊天为 Rasa Core 模型提供新的训练数据。

                        使用"'RegexInterpreter'",即"/<intent>"输入

                        格式

  model-as-positional-argument

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: None)

通往已经训练的 Rasa 模型的路径。如果目录是

                        指定的,它将使用在此的最新模型目录

                     (默认值:无)

optional arguments:

  -h, --help            show this help message and exit

  --e2e                 Save story files in e2e format. In this format user

                        messages will be included in the stories. (default:

                        False)

用e2e 格式保存story文件。 在这个格式下用户消息

将被包含在story里。

  -m MODEL, --model MODEL

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: None)

Rasa已训练模型路径。如果指定路径,将使用这个文 件夹下最后一个模型

  --data DATA [DATA ...]

                        Paths to the Core and NLU data files. (default:

                        ['data'])

Core和NLU数据文件路径

  --skip-visualization  Disable plotting the visualization during interactive

                        learning. (default: False)

交互学习期间禁止绘制可视化效果

  --conversation-id CONVERSATION_ID

                        Specify the id of the conversation the messages are

                        in. Defaults to a UUID that will be randomly

                        generated. (default:

acc276712bb84f939075bcbbfe9ad926)

指定交谈消息的id。 默认随机UUID

  --endpoints ENDPOINTS

                        Configuration file for the model server and the

                        connectors as a yml file. (default: None)

配置模型服务和连接的配置yml文件

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Train Arguments:

  -c CONFIG, --config CONFIG

                        The policy and NLU pipeline configuration of your bot.

                        (default: config.yml)

机器人策略和NLU通道配置

  -d DOMAIN, --domain DOMAIN

                        Domain specification (yml file). (default: domain.yml)

域配置文件

  --out OUT             Directory where your models should be stored.

                        (default: models)

输出模型保存地址

  --augmentation AUGMENTATION

                        How much data augmentation to use during training.

                        (default: 50)

  --debug-plots         If enabled, will create plots showing checkpoints and

                        their connections between story blocks in a file

                        called `story_blocks_connections.html`. (default:

                        False)

  --force               Force a model training even if the data has not

                        changed. (default: False)

  --persist-nlu-data    Persist the nlu training data in the saved model.

                        (default: False)

Talk to your Assistant 与你的机器人助手对话

To start a chat session with your assistant on the command line, run:

运行下面命令,开始聊天进程

rasa shell

The model that should be used to interact with your bot can be specified by --model. If you start the shell with an NLU-only model, rasa shell allows you to obtain the intent and entities of any text you type on the command line. If your model includes a trained Core model, you can chat with your bot and see what the bot predicts as a next action. If you have trained a combined Rasa model but nevertheless want to see what your model extracts as intents and entities from text, you can use the command rasa shell nlu.

通过 --model.指定与机器人交互的模型。如果使用仅 NLU 模型启动 shell,rasa shell 允许您获取在命令行上键入的任何文本的意图和实体。如果您的模型包含训练过的 Core 模型,您可以与机器人聊天,并查看机器人预测的下一个动作。如果您已训练了组合的 Rasa 模型(Core+NLU),但仍希望查看模型从文本中提取的意图和实体,您可以使用命令 rasa shell nlu。

To increase the logging level for debugging, run:

增加debug日志

rasa shell --debug

The full list of options for rasa shell is

完整的选项

usage: rasa shell [-h] [-v] [-vv] [--quiet]

                  [--conversation-id CONVERSATION_ID] [-m MODEL]

                  [--log-file LOG_FILE] [--endpoints ENDPOINTS] [-p PORT]

                  [-t AUTH_TOKEN] [--cors [CORS [CORS ...]]] [--enable-api]

                  [--response-timeout RESPONSE_TIMEOUT]

                  [--remote-storage REMOTE_STORAGE]

                  [--ssl-certificate SSL_CERTIFICATE]

                  [--ssl-keyfile SSL_KEYFILE] [--ssl-ca-file SSL_CA_FILE]

                  [--ssl-password SSL_PASSWORD] [--credentials CREDENTIALS]

                  [--connector CONNECTOR] [--jwt-secret JWT_SECRET]

                  [--jwt-method JWT_METHOD]

                  {nlu} ... [model-as-positional-argument]

positional arguments:

  {nlu}

    nlu                 Interprets messages on the command line using your NLU

                        model.

使用 NLU 解释命令行上的消息

  model-as-positional-argument

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: None)

已经训练的Rasa模型的路径。

optional arguments:

  -h, --help            show this help message and exit

  --conversation-id CONVERSATION_ID

                        Set the conversation ID. (default:

                        fe14d0a1526d48febfe82d4539d49ec9)

设定对话ID

  -m MODEL, --model MODEL

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: models)

设定已训练模型路径。

  --log-file LOG_FILE   Store logs in specified file. (default: None)

存储日志文件

  --endpoints ENDPOINTS

                        Configuration file for the model server and the

                        connectors as a yml file. (default: None)

yml配置文件

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Server Settings:

  -p PORT, --port PORT  Port to run the server at. (default: 5005)

访问端口

  -t AUTH_TOKEN, --auth-token AUTH_TOKEN

                        Enable token based authentication. Requests need to

                        provide the token to be accepted. (default: None)

开启token认证。需要提供token

  --cors [CORS [CORS ...]]

                        Enable CORS for the passed origin. Use * to whitelist

                        all origins. (default: None)

启动CORS传递源。使用*指定源白名单。

  --enable-api          Start the web server API in addition to the input

                        channel. (default: False)

允许API

  --response-timeout RESPONSE_TIMEOUT

                        Maximum time a response can take to process (sec).

                        (default: 3600)

设定最大响应超时时间

  --remote-storage REMOTE_STORAGE

                        Set the remote location where your Rasa model is

                        stored, e.g. on AWS. (default: None)

设定Rasa模型存储远程位置

  --ssl-certificate SSL_CERTIFICATE

                        Set the SSL Certificate to create a TLS secured

                        server. (default: None)

配置SSL认证来创建TLS安全服务连接

  --ssl-keyfile SSL_KEYFILE

                        Set the SSL Keyfile to create a TLS secured server.

                        (default: None)

设置SSL秘钥文件

  --ssl-ca-file SSL_CA_FILE

                        If your SSL certificate needs to be verified, you can

                        specify the CA file using this parameter. (default:

                        None)

如果你的SSL认证需要验证,就需要配置CA文件

  --ssl-password SSL_PASSWORD

                        If your ssl-keyfile is protected by a password, you

                        can specify it using this paramer. (default: None)

配置SSL秘钥文件密码

Channels:

  --credentials CREDENTIALS

                        Authentication credentials for the connector as a yml

                        file. (default: None)

连接身份验证

  --connector CONNECTOR

                        Service to connect to. (default: None)

连接服务

JWT Authentication:

  --jwt-secret JWT_SECRET

                        Public key for asymmetric JWT methods or shared

                        secretfor symmetric methods. Please also make sure to

                        use --jwt-method to select the method of the

                        signature, otherwise this argument will be ignored.

                        (default: None)

配置非对称 JWT 方法或共享的公钥秘密对称的方法                       

                  使用--jwt-method 选择签名,否则将忽略此参数。

                        (默认值:无)

  --jwt-method JWT_METHOD

                        Method used for the signature of the JWT

                        authentication payload. (default: HS256)

JWT认证的签名

Start a Server 启动服务

To start a server running your Rasa model, run:

启动运行Rasa服务

rasa run

The following arguments can be used to configure your Rasa server:

usage: rasa run [-h] [-v] [-vv] [--quiet] [-m MODEL] [--log-file LOG_FILE]

                [--endpoints ENDPOINTS] [-p PORT] [-t AUTH_TOKEN]

                [--cors [CORS [CORS ...]]] [--enable-api]

                [--response-timeout RESPONSE_TIMEOUT]

                [--remote-storage REMOTE_STORAGE]

                [--ssl-certificate SSL_CERTIFICATE]

                [--ssl-keyfile SSL_KEYFILE] [--ssl-ca-file SSL_CA_FILE]

                [--ssl-password SSL_PASSWORD] [--credentials CREDENTIALS]

                [--connector CONNECTOR] [--jwt-secret JWT_SECRET]

                [--jwt-method JWT_METHOD]

                {actions} ... [model-as-positional-argument]

positional arguments:

  {actions}

actions             Runs the action server.

启动action服务

  model-as-positional-argument

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: None)

模型位置

optional arguments:

  -h, --help            show this help message and exit

  -m MODEL, --model MODEL

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: models)

模型位置

  --log-file LOG_FILE   Store logs in specified file. (default: None)

日志位置

  --endpoints ENDPOINTS

                        Configuration file for the model server and the

                        connectors as a yml file. (default: None)

配置文件

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Server Settings:

  -p PORT, --port PORT  Port to run the server at. (default: 5005)

服务PORT端口

  -t AUTH_TOKEN, --auth-token AUTH_TOKEN

                        Enable token based authentication. Requests need to

                        provide the token to be accepted. (default: None)

启动认证

  --cors [CORS [CORS ...]]

                        Enable CORS for the passed origin. Use * to whitelist

                        all origins. (default: None)

启动CORS白名单

  --enable-api          Start the web server API in addition to the input

                        channel. (default: False)

启动服务器API

  --response-timeout RESPONSE_TIMEOUT

                        Maximum time a response can take to process (sec).

                        (default: 3600)

设定最大连接数

  --remote-storage REMOTE_STORAGE

                        Set the remote location where your Rasa model is

                        stored, e.g. on AWS. (default: None)

远程存储位置

  --ssl-certificate SSL_CERTIFICATE

                        Set the SSL Certificate to create a TLS secured

                        server. (default: None)

SSL认证

  --ssl-keyfile SSL_KEYFILE

                        Set the SSL Keyfile to create a TLS secured server.

                        (default: None)

SSL keyfile

  --ssl-ca-file SSL_CA_FILE

                        If your SSL certificate needs to be verified, you can

                        specify the CA file using this parameter. (default:

                        None)

CA证书

  --ssl-password SSL_PASSWORD

                        If your ssl-keyfile is protected by a password, you

                        can specify it using this paramer. (default: None)

SSL密码

Channels:

  --credentials CREDENTIALS

                        Authentication credentials for the connector as a yml

                        file. (default: None)

yml文件配置链接认证

  --connector CONNECTOR

                        Service to connect to. (default: None)

链接服务器

JWT Authentication:

  --jwt-secret JWT_SECRET

                        Public key for asymmetric JWT methods or shared

                        secretfor symmetric methods. Please also make sure to

                        use --jwt-method to select the method of the

                        signature, otherwise this argument will be ignored.

                        (default: None)

  --jwt-method JWT_METHOD

                        Method used for the signature of the JWT

                        authentication payload. (default: HS256)

For more information on the additional parameters, see Configuring the HTTP API. See the Rasa HTTP API docs for detailed documentation of all the endpoints.

Start an Action Server 启动action服务

To run your action server run

rasa run actions

The following arguments can be used to adapt the server settings:

usage: rasa run actions [-h] [-v] [-vv] [--quiet] [-p PORT]

                        [--cors [CORS [CORS ...]]] [--actions ACTIONS]

                        [--ssl-keyfile SSL_KEYFILE]

                        [--ssl-certificate SSL_CERTIFICATE]

                        [--ssl-password SSL_PASSWORD] [--auto-reload]

optional arguments:

  -h, --help            show this help message and exit

  -p PORT, --port PORT  port to run the server at (default: 5055)

  --cors [CORS [CORS ...]]

                        enable CORS for the passed origin. Use * to whitelist

                        all origins (default: None)

  --actions ACTIONS     name of action package to be loaded (default: None)

  --ssl-keyfile SSL_KEYFILE

                        Set the SSL certificate to create a TLS secured

                        server. (default: None)

  --ssl-certificate SSL_CERTIFICATE

                        Set the SSL certificate to create a TLS secured

                        server. (default: None)

  --ssl-password SSL_PASSWORD

                        If your ssl-keyfile is protected by a password, you

                        can specify it using this paramer. (default: None)

  --auto-reload         Enable auto-reloading of modules containing Action

                        subclasses. (default: False)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Visualize your Stories 可视化stories

To open a browser tab with a graph showing your stories:

可以打开一个可视化浏览器来查看你的stories

rasa visualize

Normally, training stories in the directory data are visualized. If your stories are located somewhere else, you can specify their location with --stories.

通常训练的stories在data目录下可以被可视化。如果你的stories在其他位置,需要用--stories.制定位置

Additional arguments are:

usage: rasa visualize [-h] [-v] [-vv] [--quiet] [-d DOMAIN] [-s STORIES]

                      [-c CONFIG] [--out OUT] [--max-history MAX_HISTORY]

                      [-u NLU]

optional arguments:

  -h, --help            show this help message and exit

  -d DOMAIN, --domain DOMAIN

                        Domain specification (yml file). (default: domain.yml)

  -s STORIES, --stories STORIES

                        File or folder containing your training stories.

                        (default: data)

  -c CONFIG, --config CONFIG

                        The policy and NLU pipeline configuration of your bot.

                        (default: config.yml)

  --out OUT             Filename of the output path, e.g. 'graph.html'.

                        (default: graph.html)

  --max-history MAX_HISTORY

                        Max history to consider when merging paths in the

                        output graph. (default: 2)

  -u NLU, --nlu NLU     File or folder containing your NLU data, used to

                        insert example messages into the graph. (default:

                        None)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Evaluating a Model on Test Data  测试数据评估模型

To evaluate your model on test data, run:

用测试数据评估模型

rasa test

Specify the model to test using --model. Check out more details in Evaluating an NLU Model and Evaluating a Core Model.

用-model制定需要测试的模型。

The following arguments are available for rasa test:

usage: rasa test [-h] [-v] [-vv] [--quiet] [-m MODEL] [-s STORIES]

                 [--max-stories MAX_STORIES] [--endpoints ENDPOINTS]

                 [--fail-on-prediction-errors] [--url URL]

                 [--evaluate-model-directory] [-u NLU] [--out OUT]

                 [--successes] [--no-errors] [--histogram HISTOGRAM]

                 [--confmat CONFMAT] [-c CONFIG [CONFIG ...]]

                 [--cross-validation] [-f FOLDS] [-r RUNS]

                 [-p PERCENTAGES [PERCENTAGES ...]] [--no-plot]

                 {core,nlu} ...

positional arguments:

  {core,nlu}

    core                Tests Rasa Core models using your test stories.

    nlu                 Tests Rasa NLU models using your test NLU data.

optional arguments:

  -h, --help            show this help message and exit

  -m MODEL, --model MODEL

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: models)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Core Test Arguments:

  -s STORIES, --stories STORIES

                        File or folder containing your test stories. (default:

                        tests)

  --max-stories MAX_STORIES

                        Maximum number of stories to test on. (default: None)

  --endpoints ENDPOINTS

                        Configuration file for the connectors as a yml file.

                        (default: None)

  --fail-on-prediction-errors

                        If a prediction error is encountered, an exception is

                        thrown. This can be used to validate stories during

                        tests, e.g. on travis. (default: False)

  --url URL             If supplied, downloads a story file from a URL and

                        trains on it. Fetches the data by sending a GET

                        request to the supplied URL. (default: None)

  --evaluate-model-directory

                        Should be set to evaluate models trained via 'rasa

                        train core --config <config-1> <config-2>'. All models

                        in the provided directory are evaluated and compared

                        against each other. (default: False)

NLU Test Arguments:

  -u NLU, --nlu NLU     File or folder containing your NLU data. (default:

                        data)

  --out OUT             Output path for any files created during the

                        evaluation. (default: results)

  --successes           If set successful predictions (intent and entities)

                        will be written to a file. (default: False)

  --no-errors           If set incorrect predictions (intent and entities)

                        will NOT be written to a file. (default: False)

  --histogram HISTOGRAM

                        Output path for the confidence histogram. (default:

                        hist.png)

  --confmat CONFMAT     Output path for the confusion matrix plot. (default:

                        confmat.png)

  -c CONFIG [CONFIG ...], --config CONFIG [CONFIG ...]

                        Model configuration file. If a single file is passed

                        and cross validation mode is chosen, cross-validation

                        is performed, if multiple configs or a folder of

                        configs are passed, models will be trained and

                        compared directly. (default: None)

  --no-plot             Don't render evaluation plots (default: False)

Create a Train-Test Split 创建训练-测试拆分

To create a split of your NLU data, run:

创建NLU数据的拆分

rasa data split nlu

You can specify the training data, the fraction, and the output directory using the following arguments:

你可以指定训练数据、分数和输出目录

usage: rasa data split nlu [-h] [-v] [-vv] [--quiet] [-u NLU]

                           [--training-fraction TRAINING_FRACTION]

                           [--random-seed RANDOM_SEED] [--out OUT]

optional arguments:

  -h, --help            show this help message and exit

  -u NLU, --nlu NLU     File or folder containing your NLU data. (default:

                        data)

  --training-fraction TRAINING_FRACTION

                        Percentage of the data which should be in the training

                        data. (default: 0.8)

  --random-seed RANDOM_SEED

                        Seed to generate the same train/test split. (default:

                        None)

  --out OUT             Directory where the split files should be stored.

                        (default: train_test_split)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

This command will attempt to keep the proportions of intents the same in train and test. If you have NLG data for retrieval actions, this will be saved to seperate files:

此命令将尝试在训练和测试中保持相同比例的意图。如果您有用于检索操作的 NLG 数据,则将此数据将保存到单独的文件:

ls train_test_split

      nlg_test_data.md     test_data.json

      nlg_training_data.md training_data.json

Convert Data Between Markdown and JSON 转换Markdown和JSON格式数据

To convert NLU data from LUIS data format, WIT data format, Dialogflow data format, JSON, or Markdown to JSON or Markdown, run:

从LUIS,WIT,Dialosflow,JSON,Markdown to JSON 或者Markdown数据中转化NLU数据

rasa data convert nlu

You can specify the input file, output file, and the output format with the following arguments:

可以指定输入文件,输出文件,输出文件格式。

usage: rasa data convert nlu [-h] [-v] [-vv] [--quiet] --data DATA --out OUT

                             [-l LANGUAGE] -f {json,md}

optional arguments:

  -h, --help            show this help message and exit

  --data DATA           Path to the file or directory containing Rasa NLU

                        data. (default: None)

  --out OUT             File where to save training data in Rasa format.

                        (default: None)

  -l LANGUAGE, --language LANGUAGE

                        Language of data. (default: en)

  -f {json,md}, --format {json,md}

                        Output format the training data should be converted

                        into. (default: None)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Export Conversations to an Event Broker 将对话导出到事件代理

To export events from a tracker store using an event broker, run:

若要使用event broker从tracker store导出事件,请运行:

rasa export

You can specify the location of the environments file, the minimum and maximum timestamps of events that should be published, as well as the conversation IDs that should be published.

可以定义环境文件路径,导出事件最大最小时间,对话IDS等。

usage: rasa export [-h] [-v] [-vv] [--quiet] [--endpoints ENDPOINTS]

                   [--minimum-timestamp MINIMUM_TIMESTAMP]

                   [--maximum-timestamp MAXIMUM_TIMESTAMP]

                   [--conversation-ids CONVERSATION_IDS]

optional arguments:

  -h, --help            show this help message and exit

  --endpoints ENDPOINTS

                        Endpoint configuration file specifying the tracker

                        store and event broker. (default: endpoints.yml)

  --minimum-timestamp MINIMUM_TIMESTAMP

                        Minimum timestamp of events to be exported. The

                        constraint is applied in a 'greater than or equal'

                        comparison. (default: None)

  --maximum-timestamp MAXIMUM_TIMESTAMP

                        Maximum timestamp of events to be exported. The

                        constraint is applied in a 'less than' comparison.

                        (default: None)

  --conversation-ids CONVERSATION_IDS

                        Comma-separated list of conversation IDs to migrate.

                        If unset, all available conversation IDs will be

                        exported. (default: None)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Start Rasa X

Rasa X is a toolset that helps you leverage conversations to improve your assistant. You can find more information about it here.

Rasa X 是一个工具集,可帮助您利用对话来改进助手。您可以在此处找到有关它的信息。

You can start Rasa X locally by executing

启动

rasa x

To be able to start Rasa X you need to have Rasa X local mode installed and you need to be in a Rasa project.

为了能够启动Rasa X,你需要安装Rasa X本地模式并在Rasa项目中运行。

Note

By default Rasa X runs on the port 5002. Using the argument --rasa-x-port allows you to change it to any other port.

RasaX默认运行在5002端口。使用--rasa-x-port 修改其他端口。

The following arguments are available for rasa x:

usage: rasa x [-h] [-v] [-vv] [--quiet] [-m MODEL] [--data DATA] [-c CONFIG]

              [--no-prompt] [--production] [--rasa-x-port RASA_X_PORT]

              [--config-endpoint CONFIG_ENDPOINT] [--log-file LOG_FILE]

              [--endpoints ENDPOINTS] [-p PORT] [-t AUTH_TOKEN]

              [--cors [CORS [CORS ...]]] [--enable-api]

              [--response-timeout RESPONSE_TIMEOUT]

              [--remote-storage REMOTE_STORAGE]

              [--ssl-certificate SSL_CERTIFICATE] [--ssl-keyfile SSL_KEYFILE]

              [--ssl-ca-file SSL_CA_FILE] [--ssl-password SSL_PASSWORD]

              [--credentials CREDENTIALS] [--connector CONNECTOR]

              [--jwt-secret JWT_SECRET] [--jwt-method JWT_METHOD]

optional arguments:

  -h, --help            show this help message and exit

  -m MODEL, --model MODEL

                        Path to a trained Rasa model. If a directory is

                        specified, it will use the latest model in this

                        directory. (default: models)

  --data DATA           Path to the file or directory containing stories and

                        Rasa NLU data. (default: data)

  -c CONFIG, --config CONFIG

                        The policy and NLU pipeline configuration of your bot.

                        (default: config.yml)

  --no-prompt           Automatic yes or default options to prompts and

                        oppressed warnings. (default: False)

  --production          Run Rasa X in a production environment. (default:

                        False)

  --rasa-x-port RASA_X_PORT

                        Port to run the Rasa X server at. (default: 5002)

  --config-endpoint CONFIG_ENDPOINT

                        Rasa X endpoint URL from which to pull the runtime

                        config. This URL typically contains the Rasa X token

                        for authentication. Example:

                        https://example.com/api/config?token=my_rasa_x_token

                        (default: None)

  --log-file LOG_FILE   Store logs in specified file. (default: None)

  --endpoints ENDPOINTS

                        Configuration file for the model server and the

                        connectors as a yml file. (default: None)

Python Logging Options:

  -v, --verbose         Be verbose. Sets logging level to INFO. (default:

                        None)

  -vv, --debug          Print lots of debugging statements. Sets logging level

                        to DEBUG. (default: None)

  --quiet               Be quiet! Sets logging level to WARNING. (default:

                        None)

Server Settings:

  -p PORT, --port PORT  Port to run the server at. (default: 5005)

  -t AUTH_TOKEN, --auth-token AUTH_TOKEN

                        Enable token based authentication. Requests need to

                        provide the token to be accepted. (default: None)

  --cors [CORS [CORS ...]]

                        Enable CORS for the passed origin. Use * to whitelist

                        all origins. (default: None)

  --enable-api          Start the web server API in addition to the input

                        channel. (default: False)

  --response-timeout RESPONSE_TIMEOUT

                        Maximum time a response can take to process (sec).

                        (default: 3600)

  --remote-storage REMOTE_STORAGE

                        Set the remote location where your Rasa model is

                        stored, e.g. on AWS. (default: None)

  --ssl-certificate SSL_CERTIFICATE

                        Set the SSL Certificate to create a TLS secured

                        server. (default: None)

  --ssl-keyfile SSL_KEYFILE

                        Set the SSL Keyfile to create a TLS secured server.

                        (default: None)

  --ssl-ca-file SSL_CA_FILE

                        If your SSL certificate needs to be verified, you can

                        specify the CA file using this parameter. (default:

                        None)

  --ssl-password SSL_PASSWORD

                        If your ssl-keyfile is protected by a password, you

                        can specify it using this paramer. (default: None)

Channels:

  --credentials CREDENTIALS

                        Authentication credentials for the connector as a yml

                        file. (default: None)

  --connector CONNECTOR

                        Service to connect to. (default: None)

JWT Authentication:

  --jwt-secret JWT_SECRET

                        Public key for asymmetric JWT methods or shared

                        secretfor symmetric methods. Please also make sure to

                        use --jwt-method to select the method of the

                        signature, otherwise this argument will be ignored.

                        (default: None)

  --jwt-method JWT_METHOD

                        Method used for the signature of the JWT

                        authentication payload. (default: HS256)

继续阅读