Skip to content

Commit

Permalink
Review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Apr 17, 2019
1 parent 2fb8e41 commit 68fa4df
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
21 changes: 18 additions & 3 deletions examples/formbot/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
help:
@echo " train"
@echo " Train a stacked model using Rasa Ccore and NLU."
@echo " train-core"
@echo " Train a dialogue model using Rasa core."
@echo " run-core"
@echo " Spin up the core server on the command line"
@echo " run-actions"
@echo " Spin up the action server"
@echo " run"
@echo " Spin up both core and the action server"
@echo " visualize"
@echo " Show your stories as a graph"

run:
make run-actions&
make run-core

run-core:
rasa shell core -m models --verbose --endpoints endpoints.yml

run-actions:
python -m rasa_core_sdk.endpoint --actions actions

train:
rasa train --debug

run:
rasa shell core -m models --verbose --endpoints endpoints.yml
train-core:
rasa train core -s data/stories.md --debug

train-interactive:
rasa interactive core -d domain.yml -m models -c config.yml --data data --verbose --endpoints endpoints.yml
rasa interactive -d domain.yml -m models -c config.yml --data data --verbose --endpoints endpoints.yml

visualize:
rasa show stories
11 changes: 5 additions & 6 deletions examples/formbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ Using this example you can build an actual assistant which demonstrates the
functionality of the FormAction. You can use the example using the following
steps:

1. Train the Rasa NLU and Rasa Core model by running:
```make train```
This will train the Rasa NLU model and Rasa Core model.
The models will be stored in the `/models` directory.
1. Train a stacked model containing the Rasa NLU and Rasa Core models by running:
```make train```
The model will be stored in the `/models` directory as a zipped file.

2. Test the assistant by running:
```make run```
2. Test the assistant by running:
```make run```
This will load the assistant in your command line for you to chat.


Expand Down
2 changes: 1 addition & 1 deletion examples/restaurantbot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ help:
@echo " run-core"
@echo " Runs the core server."
@echo " train"
@echo " Train a stacked model using Rasa core & NLU."
@echo " Train a stacked model using Rasa Core & NLU."

run:
make run-actions&
Expand Down
2 changes: 1 addition & 1 deletion examples/restaurantbot/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def train_nlu(
parse_parser = subparser.add_parser("parse", help="parse any text")

parse_parser.add_argument(
"--nlu-model", default="models/nlu", help="Path to the nlu model."
"--nlu-model", default=None, help="Path to the nlu model."
)
parse_parser.add_argument(
"--core-model", default="models/core", help="Path to the core model."
Expand Down
8 changes: 6 additions & 2 deletions tests/core/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ async def test_formbot_example():

async def test_restaurantbot_example():
sys.path.append("examples/restaurantbot/")
from run import train_core, parse
from run import train_core, train_nlu, parse

p = "examples/restaurantbot/"
stories = os.path.join("data", "test_stories", "stories_babi_small.md")
nlu_data = os.path.join(p, "data", "nlu.md")
core_model_path = await train_core(
os.path.join(p, "domain.yml"), os.path.join(p, "models", "core"), stories
)
nlu_model_path = train_nlu(
os.path.join(p, "config.yml"), os.path.join(p, "models", "nlu"), nlu_data
)

responses = await parse("/greet", core_model_path)
responses = await parse("hello", core_model_path, nlu_model_path)

assert responses[0]["text"] == "how can I help you?"

0 comments on commit 68fa4df

Please sign in to comment.