0

I try to understand the logic behind the weather bot in the wit.ai quick-start.The story is build with a trait intent (supposed to be something like "what is the weather ?") and an entity is declared to get where the weather is wondered. So, I would think this story is only triggered when weather is asked AND location is given.

This is not the case since the illustration of jump / bookmarks just below this first step deals with unset location.

Hence my question : how does Wit.ai decide which story to trigger ?

  • Maybe should I declare the first action of the story as needing a `wit/location` entity using the `only if ...` option in the action tab ? – François Perret Nov 05 '16 at 20:20

1 Answers1

0

Actually, there is no difference between :

What is the weather in Barcelona ? and What is the weather ?

from a decision regarding the next action to choose from the Wit engine standpoint. Previous contexts and current context (and contained key) are what matters for this task. As the quick-start puts it:

Only trait entities have their value influence the prediction. For non-trait entities, the value is ignored with regards to action prediction.

My advice on this is to create a flushContext action which returns an empty context and to trigger it everytime a give story comes to an end.

  • I see the point of using 'flushContext' but some stories could be looped, hence context should be kept. btw, the decision regarding the next action, as you said, takes into account the previous and the current context, but what if the intent/trait (correctly identifed by wit) should trigger a completely different story? I'm having this issue, and I don't know how to workaround it... – Carlos Araya Nov 07 '16 at 17:59
  • and how does merge work when you have 2 or more stories, btw merge is deprecated, just went through the source code for node-wit, check the validateActions method and dont you think flushing the context at the end of each story is a bad idea – PirateApp Nov 23 '16 at 14:13