How to store conversations in stories.md file

Hello, I have created a custom user interface and I want to know how to add those stories to stories.md file

http://localhost:5005/conversations/default/story

using the above api I’m getting the response as below:

default

  • greet: hello there
  • utter_greet
  • casual_talks2: how are you?
  • utter_casual_talks2

So, I want to know how to add this story to stories.md file.

Thanks in advance.

can anyone help we with this?

I’m not a pro at Rasa (only started using it a couple months ago), but I can’t think of a way to automatically add/append it to stories.md

You CAN however… stay with me here, I hope this is what you’re trying to do

  • create the directory data/core
  • move stories.md into that directory
  • Unrelated to your issue - you can also create data/nlu and move nlu.md there if you want to further organize your files.

Having this new core directory, will allow you to have multiple .md story files (same with nlu). The filenames don’t matter as any .md file in “core” will get pulled in and used when you train.

You could then write a script to hit your API endpoint, take the story response and write that response out to a new .md file in the core directory (maybe use the timestamp as the filename).

Then next time you train the bot, that story will be used in the mix with the other .md files in the core directory

Am I close to what you’re trying to do?

okay understood. but, there is a problem The story which we are getting when we are hitting the API(http://localhost:5005/conversations/default/story) is in the below format:

  • greet: hello
    • utter_greet
  • thanks: ok
    • utter_thanks
  • goodbye: no thanks for the help
    • utter_goodbye
  • goodbye: see you
    • utter_goodbye

when I’m trying to do rasa train it is saying as found unknown intents. so, what can i do now?

Two things come to mind.

Do you have the intents setup in domain.yml for greet, thanks and goodbye? It’s strange that your API would kick those out if they were not defined.

If you do, it is possible that the story format is incorrect. It is hard to tell because of how this editor handles markup. You have to actually select your text and then click the preformatted text button.

Can you verify if the story generated from your API has this format:

## story-name
* intent
  - utterance
* intent
  - utterance
1 Like
  • greet: hello
    • utter_greet
  • thanks: ok
    • utter_thanks
  • goodbye: no thanks for the help
    • utter_goodbye
  • goodbye: see you
    • utter_goodbye

It is in the above format but the story format should be in the below format:

  • greet
    • utter_greet
  • thanks
    • utter_thanks
  • goodbye
    • utter_goodbye
  • goodbye
    • utter_goodbye

Yea that makes sense with the error you’re seeing then because during training it’s looking for an intent named “greet: hello”, not just greet.

You mentioned you built a custom interface. Did you built this api call too?

http://localhost:5005/conversations/default/story

I was looking and I don’t see /conversations/default/story in the api docs, unless I missed it. That api endoint (/conversations/default/story) doesn’t work with my bot here.

If you did create that api call, then you could potentially alter the response. If you did not, you could write something to remove the user reply portion (the : whatever) from the file before you toss it into your stories.md file.

I think the RASA folks are at their conference so hopefully if I’m all wrong and there’s a better way they’ll jump in next week.