Context: I’m looking to migrate my bot from the .md training examples (1.x) to the .yml format (2.x) and I’m getting some trouble with Rasa.
I’m currently using slot type “any” (reference here: Domain) for certain objects that are gathered during the conversation. However, these objects that I use during the conversation, are either a list or a JSON/dictionary type. After I used the automated migration script for my stories, running the rasa train command gave me multiple errors that these slots when set are not of the type str, bool, list, text.
So I removed all of the “problematic stories” with these slots and tried to create stories afresh using rasa interactive hoping that it’ll give me the right format. However, once I exported the stories and re-ran the training, I got the same error even for the format that rasa interactive exported. The JSON seems to be represented as a multi-level bulleted list inside the slot_was_set node of the story.
I also tried actually putting in the JSON in place of the tree and got the same result.
How should I format a slot of type “any”, especially if it could be a JSON?
It trains alright and when I set this kind of slot value from within a custom action, it behaves like it should (like a dictionary) when I access it later.
Regarding the migration script and interactive learning: What’s the format you get from those? Is it the same, just not quoted? If yes, then I guess we need to fix it (it’d be awesome if you could report the bug on GitHub by creating an issue).
I also reckon that there should be an example in the docs of how a dict/list slot value should be written in data. If you want, you can add this to the docs yourself and create a pull request
Okay I’ll try training with the single quotes surrounding the JSON.
when I set this kind of slot value from within a custom action, it behaves like it should (like a dictionary) when I access it later.
I can confirm that this works correctly as well during the conversation. This was when I was using rasa interactive to understand how the format is exported.
Regarding the migration script and interactive learning: What’s the format you get from those? Is it the same, just not quoted?
Yes; both the migration and the interactive learning give the same format. It converts lists and JSON objects into a tree structure within YAML, which then blocks the training.
Hey @ganeshv, you may’ve noticed some disagreement around this. I have to admit that while answering your questions I never thought about Melinda’s point – that actually slots of type any are useless in stories as they never influence the conversation. Now, strictly speaking, these slots can be included in your training stories. And maybe you want to have them there for clarity (I sometimes do this too). But they will never influence your models trained on those stories.
So, given the context: My answers above mostly hold, but we agreed to not change the docs because we don’t want to encourage anyone to include slots of type any in stories. Interactive Learning will change as soon as possible so that it doesn’t include those slots in exported stories. And as for the migration scripts, those need to change too so as not to break training (thanks for creating the issue for this!).