天天看點

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)

繼續閱讀