Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

Rasa 官网


www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

rasa shell

您可以在本地模式下使用Rasa X在UI中与您的助手交谈。查看Rasa X文档了解更多细节。
如果你更喜欢使用命令行,你可以通过运行以下命令来启动一个聊天会话:

rasa shell

默认情况下,这将加载最新的训练模型。你可以使用 --model标志来指定要加载的不同模型。
如果你用一个NLU-only模型启动shell, rasa shell会输出你输入的任何消息的意图和实体。
如果你训练了一个组合的Rasa模型,但只是想看看你的模型从文本中提取的意图和实体,你可以使用命令Rasa shell nlu。
要增加调试的日志级别,请执行:

rasa shell --debug

请注意:为了看到在外部通道中可能看到的典型问候和/或会话启动行为,需要显式地发送/session_start作为第一个消息。否则,会话启动行为将按照会话配置中的描述开始。

可以使用以下参数配置该命令:

usage: rasa shell [-h] [-v] [-vv] [--quiet]
                  [--conversation-id CONVERSATION_ID] [-m MODEL]
                  [--log-file LOG_FILE] [--use-syslog]
                  [--syslog-address SYSLOG_ADDRESS]
                  [--syslog-port SYSLOG_PORT]
                  [--syslog-protocol SYSLOG_PROTOCOL] [--endpoints ENDPOINTS]
                  [-i INTERFACE] [-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.
  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
  --conversation-id CONVERSATION_ID
                        Set the conversation ID. (default:
                        54029573f170423bbc3343e96efadcb5)
  -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)
  --use-syslog          Add syslog as a log handler (default: False)
  --syslog-address SYSLOG_ADDRESS
                        Address of the syslog server. --use-sylog flag is
                        required (default: localhost)
  --syslog-port SYSLOG_PORT
                        Port of the syslog server. --use-sylog flag is
                        required (default: 514)
  --syslog-protocol SYSLOG_PROTOCOL
                        Protocol used with the syslog server. Can be UDP
                        (default) or TCP (default: UDP)
  --endpoints ENDPOINTS
                        Configuration file for the model server and the
                        connectors as a yml file. (default: endpoints.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:
  -i INTERFACE, --interface INTERFACE
                        Network interface to run the server on. (default:
                        0.0.0.0)
  -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.Note that this key is meant for securing the
                        HTTP API. (default: None)
  --jwt-method JWT_METHOD
                        Method used for the signature of the JWT
                        authentication payload. (default: HS256)

运行一个示例

www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

rasa run

要启动一个运行你训练过的模型的服务器,运行:

rasa run

默认情况下,Rasa服务器使用HTTP进行通信。为了保证与SSL通信的安全性,并在HTTPS上运行服务器,需要提供有效的证书和相应的私钥文件。您可以将这些文件指定为rasa run运行命令的一部分。如果在创建过程中使用密码加密了密钥文件,还需要添加–ssl-password。

rasa run --ssl-certificate myssl.crt --ssl-keyfile myssl.key --ssl-password mypassword

默认情况下,Rasa监听每个可用的网络接口。您可以使用-i命令行选项将其限制为特定的网络接口。

rasa run -i 192.168.69.150

下面的参数可以用来配置您的Rasa服务器:

usage: rasa run [-h] [-v] [-vv] [--quiet] [-m MODEL] [--log-file LOG_FILE]
                [--use-syslog] [--syslog-address SYSLOG_ADDRESS]
                [--syslog-port SYSLOG_PORT]
                [--syslog-protocol SYSLOG_PROTOCOL] [--endpoints ENDPOINTS]
                [-i INTERFACE] [-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.
  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)
  --use-syslog          Add syslog as a log handler (default: False)
  --syslog-address SYSLOG_ADDRESS
                        Address of the syslog server. --use-sylog flag is
                        required (default: localhost)
  --syslog-port SYSLOG_PORT
                        Port of the syslog server. --use-sylog flag is
                        required (default: 514)
  --syslog-protocol SYSLOG_PROTOCOL
                        Protocol used with the syslog server. Can be UDP
                        (default) or TCP (default: UDP)
  --endpoints ENDPOINTS
                        Configuration file for the model server and the
                        connectors as a yml file. (default: endpoints.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:
  -i INTERFACE, --interface INTERFACE
                        Network interface to run the server on. (default:
                        0.0.0.0)
  -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.Note that this key is meant for securing the
                        HTTP API. (default: None)
  --jwt-method JWT_METHOD
                        Method used for the signature of the JWT
                        authentication payload. (default: HS256)

有关其他参数的更多信息,请参见模型存储。有关所有端点的详细文档,请参阅Rasa HTTP API页面。

运行一个示例:
(installingrasa) C:\Users\admin>rasa run -i 127.0.0.1 --model E:\starspace\my_rasa\models\20211227-124216-active-fort.tar.gz

www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run
www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

Rasa官网链接:

www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run


www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run
www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run
www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run
www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run
www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run
www.zeeklog.com  - Transformer课程 业务对话机器人Rasa 3.x 命令 rasa shell 及rasa run

Rasa系列博客:

Read more

深入理解 Proxy 和 Object.defineProperty

在JavaScript中,对象是一种核心的数据结构,而对对象的操作也是开发中经常遇到的任务。在这个过程中,我们经常会使用到两个重要的特性:Proxy和Object.defineProperty。这两者都允许我们在对象上进行拦截和自定义操作,但它们在实现方式、应用场景和灵活性等方面存在一些显著的区别。本文将深入比较Proxy和Object.defineProperty,包括它们的基本概念、使用示例以及适用场景,以帮助读者更好地理解和运用这两个特性。 1. Object.defineProperty 1.1 基本概念 Object.defineProperty 是 ECMAScript 5 引入的一个方法,用于直接在对象上定义新属性或修改已有属性。它的基本语法如下: javascript 代码解读复制代码Object.defineProperty(obj, prop, descriptor); 其中,obj是目标对象,prop是要定义或修改的属性名,descriptor是一个描述符对象,用于定义属性的特性。 1.2 使用示例 javascript 代码解读复制代码//

By Ne0inhk

Proxy 和 Object.defineProperty 的区别

Proxy 和 Object.defineProperty 是 JavaScript 中两个不同的特性,它们的作用也不完全相同。 Object.defineProperty 允许你在一个对象上定义一个新属性或者修改一个已有属性。通过这个方法你可以精确地定义属性的特征,比如它是否可写、可枚举、可配置等。该方法的使用场景通常是需要在一个对象上创建一个属性,然后控制这个属性的行为。 Proxy 也可以用来代理一个对象,但是相比于 Object.defineProperty,它提供了更加强大的功能。使用 Proxy 可以截获并重定义对象的基本操作,比如访问属性、赋值、函数调用等等。在这些操作被执行之前,可以通过拦截器函数对这些操作进行拦截和修改。因此,通过 Proxy,你可以完全重写一个对象的默认行为。该方法的使用场景通常是需要对一个对象的行为进行定制化,或者需要在对象上添加额外的功能。 对比 以下是 Proxy 和 Object.defineProperty 的一些区别对比: 方面ProxyObject.defineProperty语法使用 new Proxy(target,

By Ne0inhk