Rasa Core - How to write reliable stories

Today I tried out Rasa Core to see if it is really the better alternative too a decision tree. I made up a super simple story and did not include any actions, only simple utterances.

Idea

The idea is,…

…that I can order drinks in a loop until I’m satisfied

…each time I order a “fanta”, the bot makes an additional comment “bamboocha”

That’s it!

Problem

I don’t make it to build such a flow. I tried many different stories, but always had some problems. In the attached sample I have the following problems:

  • If I order a coke after the greeting, the bot tells me “bamboocha” (should only happen with fanta)
  • The visualisation shows me a loop for order a drink, but not one for ordering fanta

Questions

Can you help me…

  • …to solve the specific problem?
  • …with general knowledge how to write stories?
  • …to get rid of my doubts, that this never can work for a complex project, if I have already so many problem with this super simple example?

Training data

Stories

## story_greet
* greet
 - utter_greet
> check_greet

## story_order_drink
> check_greet
* orderdrink
 - utter_anythingelse
* orderdrink
 - utter_anythingelse
> check_finish

## story_order_fanta_1
> check_greet
* orderdrink
 - utter_anythingelse
* orderdrink{"drink":"fanta"}
 - utter_bamboocha
 - utter_anythingelse
> check_finish

## story_order_fanta_2
> check_greet
* orderdrink{"drink":"fanta"}
 - utter_bamboocha
 - utter_anythingelse
* orderdrink
 - utter_anythingelse
> check_finish

## story_finish
> check_finish
* finish
 - utter_goodbye

Visualisation, Domain and NLU

domain.yml (351 Bytes) graph.html (4.8 KB) nlu_data.md (1.0 KB)

I’m more than curious for your inputs. Many thanks!

1 Like

Are there any field reports, best practices or just experiences with RASA Core and the use of sample stories? Where you I find them?

1 Like

Hi Chris, have you already tried using a slot for drinks, and specifically a slot of type categorized? Slots and slot types are declared in the domain.yml like

slots: drink: type: categorical values: - fanta - rivella

See here in the docs: https://rasa.com/docs/core/slots/ https://rasa.com/docs/core/api/slots_api/

If you give it a try, please let me know what you found.

1 Like

Finally I found time to test that. The result is more or less the same. I can’t create reliable stories. If I wan’t to react different depending on the entity (or/and slot) value, it does not work.

Additional thoughts:

  • The ML seams to ignore that orderdrink{"drink": "coke"} is a specification and orderdrink (without a concrete entity value) a generalisation. In my eyes the specification should have a stronger impact on the decision.

  • Interactive learning is good idea, but to reach my goal I will “train” hundreds of times. A plain decision tree would be way more effective, less time consuming and not as error prone.

  • How can that scale, if it does not work with such an easy sample?

I heard so many good comments about RASA CORE. I would be super glad to understand how I can use Rasa Core the right way (or at least that somebody tells me that it is not as cool). Thanks for all input.

2 Likes

Hi all. @Chris @weberi @juste_petr @Tanja @amn41 Please help me with below issue I have a question regarding writing stories.Suppose I have two intents Order and Shipping. Order checks order status and shipping is to get the shipping address. For this I have 3!(Factorial) combinations. 1)greetings, order status, shipping address 2)greetings, shipping address, order status 3)without greeting, direct OS and SA 4)without greeting, direct SA and OS. So my question is do I need to write every possible combination in stories? What if I have many such types. Say I have 100 types, it will sum up to 100!, for which it is humanly impossible to write those combination stories.

hi @iampkk - it depends on the behaviour you want.

  • if each of these intents always results in the same action, you can set your max_history to 1, or use the mapping policy, see Tutorial: Building Assistants

  • if you want your assistant to also handle context, you can use AugmentedMemoization or ML-based policies, see Tutorial: Building Assistants . These were designed for exactly this behaviour.

This can be done in your action.py file. Don’t use separate responses but use if/else statement for your output file in the action response that you’ve created.

can you elaborate using an example ?