Rasa API CLI
This command line tool has initially been developed to import content from existing Rasa bots to Rasa X and to clean-up Rasa X so that you can more easily remove all of the content and upload new content on the same instance.
It has been developed in TypeScript with oclif.
To install:
npm install -g rasacli
If you don't have node
and npm
installed, run these commands to install on Debian-based systems:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
source ~/.profile
nvm install 12
node --version
npm install -g rasacli
rasacli --version
Set environment variables:
export RASA_HOST=mybot.domain.com
export RASA_USER=me
export RASA_PASS=mypass
Command | Details |
---|---|
rasacli --help | Command options list |
rasacli modellist | List models |
rasacli delall | Delete all bot content |
Importing content:
rasacli updtraining data/training/*md
rasacli addstories data/stories/*md
rasacli upddomain data/domain.yml
rasacli updtemplates data/domain.yml
rasacli updconfig data/config.yml
Export existing content:
rasacli getdomain > domain.yaml
rasacli getstories > stories.json
rasacli getstoriesmd > stories.md
rasacli gettraining > nlu.json
Train, list and activate model:
MODEL=`rasacli modeltrain`
rasacli modelactivate --model $MODEL
rasacli modellist
Rasa, Rasa X & rasacli version information:
rasacli version
rasacli vers
The rasacli will use the following environment variables in lieu of their associated command line options:
Env | Option | Description |
---|---|---|
RASA_HOST | -n | Rasa X hostname |
RASA_PORT | -p | Rasa X server port |
RASA_PROTO | --protocol | Server protocol |
RASA_USER | --username | Username |
RASA_PASS | --password | Password |
RASA_TOKEN | --token | Token |
- Fixed
modeltrain
exit code not set - Added
getconfig
andupdconfig
for config.yml - Added
modellist
- Added
modeldelete
- Added
modeladdtag
,modeldeletetag
,modelgettag
- Rasa X enterprise only - Added
--project
option tomodeltrain
, default value isdefault
- Added
vers
to display Rasa & Rasa X version info - Added
-v
verbose option - Added
modeltrain
to train the model, returns the name of the new model - Added
modelactivate
to activate a mode, pass the name of the model with-m
- Added
updtraining
to replace NLU training data. Accepts a list of markdown files.
- Added
updtemplates
to update response templates. This replacesupddomain -t
- Added
getentities
command - Added
deltemplates
to replacedeldomain -t
but discovered a bug in this api, see #4185 - Added
delall
command which calls all of the delete commands supported byrasacli
Added deldomain
command which is the same as an upddomain
but with an empty dataset (you don't have to supply an empty markdown file). Also fixes an addstories
file name processing issue.
upddomain
command added -t
option to specify update of templates. See API domain PUT for details on store_templates
option along with Rasa X API Github issue #4080.
Initial set of commands: addstories
, delstories
, deltraining
, getdomain
, getstories
, getstoriesmd
, gettraining
, upddomain
There's a summary of the Rasa X REST endpoints here.
To add a new command to this project (make sure you save the README.md before running):
npx oclif command NAME
To test a commmand:
./bin/run getstories -v
Force update of README.md (make sure you save the README.md before running):
yarn prepack
Publish an updated version of rasacli
:
npm version (major|minor|patch)
npm publish
Publish a beta update:
npm version <new version>-beta.0
npm publish --tag beta
Install beta release:
npm install -g rasacli@beta.
$ npm install -g rasacli
$ rasacli COMMAND
running command...
$ rasacli (-v|--version|version)
rasacli/0.4.7 darwin-x64 node-v12.9.0
$ rasacli --help [COMMAND]
USAGE
$ rasacli COMMAND
...
- rasacli
- Installation
- Examples
- Environment Variables
- Release Notes - 0.4.5 - Oct 7, 2019 - 0.4.0 - Oct 4, 2019 - 0.3.0 - Aug 8, 2019 - 0.2.0 - Aug 6, 2019 - 0.1.3 - Aug 4, 2019 - 0.1.2 - Jul 24, 2019 - 0.1.1 - Jul 23, 2019
- Developer Notes
- Usage
- Commands
rasacli addstories FILE
rasacli delall
rasacli deldomain
rasacli delstories
rasacli deltemplates
rasacli deltraining
rasacli getconfig
rasacli getdomain
rasacli getentities
rasacli getstories
rasacli getstoriesmd
rasacli gettraining
rasacli help [COMMAND]
rasacli modelactivate
rasacli modeladdtag
rasacli modeldelete
rasacli modeldeletetag
rasacli modelgettag
rasacli modellist
rasacli modeltrain
rasacli updconfig FILE
rasacli upddomain FILE
rasacli updstories FILE
rasacli updtemplates FILE
rasacli updtraining FILE
rasacli vers
Add stories
USAGE
$ rasacli addstories FILE
ARGUMENTS
FILE Markdown story files (accepts multiple files)
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/addstories.ts
Update domain
USAGE
$ rasacli delall
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/delall.ts
Delete domain
USAGE
$ rasacli deldomain
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/deldomain.ts
Delete all stories
USAGE
$ rasacli delstories
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/delstories.ts
Delete templates
USAGE
$ rasacli deltemplates
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/deltemplates.ts
Delete all training data
USAGE
$ rasacli deltraining
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/deltraining.ts
Get config
USAGE
$ rasacli getconfig
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/getconfig.ts
Get training data
USAGE
$ rasacli getdomain
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/getdomain.ts
Get entities
USAGE
$ rasacli getentities
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/getentities.ts
Get stories
USAGE
$ rasacli getstories
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/getstories.ts
Get stories as markdown
USAGE
$ rasacli getstoriesmd
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/getstoriesmd.ts
Get training data
USAGE
$ rasacli gettraining
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/gettraining.ts
display help for rasacli
USAGE
$ rasacli help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
Activate a model
USAGE
$ rasacli modelactivate
OPTIONS
-h, --help show CLI help
-m, --model=model (required) model
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modelactivate.ts
Add tag to model, enterprise vesion only
USAGE
$ rasacli modeladdtag
OPTIONS
-h, --help show CLI help
-m, --model=model (required) model
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-t, --tag=tag (required) tag
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modeladdtag.ts
Delete a model
USAGE
$ rasacli modeldelete
OPTIONS
-h, --help show CLI help
-m, --model=model (required) model
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modeldelete.ts
Delete tag from model, enterprise vesion only
USAGE
$ rasacli modeldeletetag
OPTIONS
-h, --help show CLI help
-m, --model=model (required) model
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-t, --tag=tag (required) tag
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modeldeletetag.ts
Get model with tag, downloads zipped model
USAGE
$ rasacli modelgettag
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-t, --tag=tag (required) tag
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modelgettag.ts
Activate a model
USAGE
$ rasacli modellist
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modellist.ts
Train a new model
USAGE
$ rasacli modeltrain
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/modeltrain.ts
Update config
USAGE
$ rasacli updconfig FILE
ARGUMENTS
FILE Domain yaml file
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/updconfig.ts
Update domain
USAGE
$ rasacli upddomain FILE
ARGUMENTS
FILE Domain yaml file
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/upddomain.ts
Update stories
USAGE
$ rasacli updstories FILE
ARGUMENTS
FILE Markdown story files (accepts multiple files)
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/updstories.ts
Update templates
USAGE
$ rasacli updtemplates FILE
ARGUMENTS
FILE Domain yaml file
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/updtemplates.ts
Update training
USAGE
$ rasacli updtraining FILE
ARGUMENTS
FILE NLU training files (accepts multiple files)
OPTIONS
-f, --format=format [default: md] format (json, md)
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--project=project [default: default] Project name
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/updtraining.ts
Show version and status information
USAGE
$ rasacli vers
OPTIONS
-h, --help show CLI help
-n, --hostname=hostname [default: localhost] hostname
-p, --port=port [default: 80] port
-v, --verbose verbose
--password=password password
--protocol=protocol [default: http] protocol
--token=token token
--username=username [default: me] username
See code: src/commands/vers.ts