Rasa教程系列-1-命令行交互

0. 背景

本文主要介紹Rasa中常用的命令行交互方式。

1. 命令行速查表

命令 作用
rasa init 創建一個新項目,且帶有訓練數據集、actions和配置文件
rasa train 基於NLU數據和 Stories數據訓練模型,並將結果模型保存與./models中
rasa interactive 啓動一個交互式學習session以通過聊天的方式創建新的訓練數據集
rasa shell 加載已經訓練的model並以命令行方式與assistant進行對話
rasa run 以已訓練的模型啓動Rasa server,更多詳情可以參考 Running the Server
rasa run actions 基於Rasa SDK啓動一個action server
rasa visualize 可視化stories
rasa test 使用test NLU data和stories對已經訓練的Rasa模型進行test
rasa data split nlu 根據指定的百分比對NLU data進行數據切分
rasa data convert nlu 對NLU training data進行不同的格式的轉換
rasa x 在本地啓動 Rasa X
rasa -h 展示所有可能的命令

上一篇博文已經展示了rasa init的使用,這裏不再贅述。單純使用rasa init且不訓練一個初始化模型的話,創建的項目就沒有models目錄。

2. 訓練模型

訓練模型的命令:

rasa train

該命令聯合Rasa NLU 和 Rasa Core 模型訓練一個Rasa 模型。如果僅想要訓練 NLU 或 Core 模型,可以使用如下命令:rasa train nlurasa train core。值得一提的是,Rasa 會自動跳過 NLU 模型或 Core 模型的訓練,當其對應的訓練數據和配置文件沒有改變時。

rasa train訓練的結果模型可以用--out來指定,默認是./models。模型的名字默認是<timestamp>.tar.gz,可以通過--fixed-model-name來自命名模型名字。下述的參數可以用以配置訓練過程:

usage: rasa train [-h] [-v] [-vv] [--quiet] [--data DATA [DATA ...]]
                  [-c CONFIG] [-d DOMAIN] [--out OUT]
                  [--augmentation AUGMENTATION] [--debug-plots]
                  [--dump-stories] [--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.
    nlu                 Trains a Rasa NLU model using your NLU data.

optional arguments:
  -h, --help            show this help message and exit
  --data DATA [DATA ...]
                        Paths to the Core and NLU data files. (default:
                        ['data'])
  -c CONFIG, --config CONFIG
                        The policy and NLU pipeline configuration of your bot.
                        (default: config.yml)
  -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)
  --dump-stories        If enabled, save flattened stories to a file.
                        (default: False)
  --fixed-model-name FIXED_MODEL_NAME
                        If set, the name of the model file/directory will be
                        set to the given name. (default: None)
  --persist-nlu-data    Persist the nlu training data in the saved model (將nlu訓練數據保存到保存的模型中).
                        (default: False)
  --force               Force a model training even if the data has not
                        changed. (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)

PS:
訓練時要確保 NLU 和 Core的訓練數據集存在。如果只存在一者,rasa train會根據提供的訓練數據集自動回退到rasa train nlurasa train core

3. 交互式學習

啓動交互式學習session:

rasa interactive

當用--model提供已經訓練過的模型,交互式可以始於該模型。如果沒有指定模型,rasa interactive將會用data/目錄(沒有重新給--data指定新目錄的話)下的數據訓練一個新的Rasa模型。在訓練完該初始模型後,交互式學習session將會正式開始。如果訓練數據和配置沒有改變,訓練將被跳過。rasa interactive的相關參數如下:

usage: rasa interactive [-h] [-v] [-vv] [--quiet] [--e2e] [-m MODEL]
                        [--data DATA [DATA ...]] [--skip-visualization]
                        [--endpoints ENDPOINTS] [-c CONFIG] [-d DOMAIN]
                        [--out OUT] [--augmentation AUGMENTATION]
                        [--debug-plots] [--dump-stories] [--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.
  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
  --e2e                 Save story files in e2e format. In this format user
                        messages will be included in the stories. (default:
                        False)
  -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)
  --data DATA [DATA ...]
                        Paths to the Core and NLU data files. (default:
                        ['data'])
  --skip-visualization  Disable plotting the visualization during interactive
                        learning. (default: False)
  --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)

Train Arguments:
  -c CONFIG, --config CONFIG
                        The policy and NLU pipeline configuration of your bot.
                        (default: config.yml)
  -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)
  --dump-stories        If enabled, save flattened stories to a file.
                        (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)

交互式學習示例:
在這裏插入圖片描述

4. Talk to Assistant

通過命令行方式直接與Assistant交流:

rasa shell

可以通過--model指定特定的模型。當只想要啓動NLU模型時,可以通過rasa shell nlu來對輸入的句子進行NLU分析,獲得意圖和實體。具體示例如下:
在這裏插入圖片描述

當模型中包含有 Core 模型時就可以與其進行對話,並看到Assistant的預測(即下一個action)。rasa shell的相關參數如下:

usage: rasa shell [-h] [-v] [-vv] [--quiet] [-m MODEL] [--log-file LOG_FILE]
                  [--endpoints ENDPOINTS] [-p PORT] [-t AUTH_TOKEN]
                  [--cors [CORS [CORS ...]]] [--enable-api]
                  [--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.
  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)
  -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)
  --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)

5. 啓動Rasa Server

啓動Rasa Server命令如下:

rasa run

相關的參數如下:

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]
                [--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.
  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)
  -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)
  --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)

有關附加參數的更多信息,可以參見Running the Server。各個endpoints的詳情可以參見HTTP API

6. 啓動 Action Server

啓動Action Server的命令:

rasa run actions

該命令相關的參數如下:

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]

各個參數的詳情:

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)

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)

7. Stories的可視化

命令如下:

rasa visualize

默認情況下是對data/下的訓練數據進行可視化,當然可以通過--stories指定特定的stories。該命令的參數如下:

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)

示例結果:
在這裏插入圖片描述

graph.html的可視化結果如下:
在這裏插入圖片描述

8. 用test數據對模型進行評估

模型評估命令:

rasa test

可以通過--model指定要評估的模型。更多關於模型的細節可以參考Evaluating an NLU ModelEvaluating a Core Model
rasa test命令的相關參數如下:

usage: rasa test [-h] [-v] [-vv] [--quiet] [-m MODEL] [-s STORIES]
                 [--max-stories MAX_STORIES] [--e2e] [--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:
                        data)
  --max-stories MAX_STORIES
                        Maximum number of stories to test on. (default: None)
  --e2e, --end-to-end   Run an end-to-end evaluation for combined action and
                        intent prediction. Requires a story file in end-to-end
                        format. (default: False)
  --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:![在這裏插入圖片描述](https://img-blog.csdnimg.cn/20200109210349426.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xqcDE5MTk=,size_16,color_FFFFFF,t_70)
                        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)

示例:
在這裏插入圖片描述

上述示例並沒有指定--stories,所以是使用默認的./data下的數據進行評估,用訓練數據集來評測,結果自然好得沒話說。這裏僅僅爲了展示命令行的使用,並沒有再造新的test數據集。

9. 劃分Train-test數據集

可以通過rasa data split nlu對NLU劃分爲train和test數據集。默認情況下,train和test數據集的intents比例是8:2,默認情況下劃分後的數據存放於./train_test_split目錄。
rasa data split nlu的相關參數如下:

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)

10. Markdown和JSON數據格式之間的轉換

對NLU數據集,從LUIS、WIT、Dialogflow、JSON、Markdown轉爲JSONMarkdown

rasa data convert nlu

可以通過如下參數指定輸入、輸出文件和輸出格式:

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)

11. 啓動Rasa X

Rasa X是一個輔助創建、改善、部署 AI Assistants的工具,更多關於Rasa X可以參考這裏
通過下述命令rasa x啓動Rasa X之前需要安裝Rasa X。上篇博文已經簡單介紹。Rasa X默認端口號是5002,可以通過--rasa-x-port重新指定。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]
              [--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)
  --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)

示例如下:
在這裏插入圖片描述

在瀏覽器中打開鏈接,選擇模型,再進行對話,對話效果如下:
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章