just-ai/jaicf-kotlin

Question - Using states as conditional "gateways"

CiaronHowell opened this issue · 6 comments

Is it possible to have a parent state with an activator which, when activated, starts evaluating the inner states straightaway without the user giving another utterance?

I've tried to visualise what I mean by conditional "gateways" below, so as mentioned in the initial question, when the parent activator is satisfied, JAICF doesn't reply with anything and instantly evaluates the inner states to compare the given intent with the activators.

Parent state with conditional activator which doesn't have an action (checking for whether a context variable is not null)
|
|-> Inner State with an intent activator and an action
|
|-> Inner State with intent activator and an action

The reason I am asking this question is that I've got experience in using Watson Assistant. This framework uses nodes (can be considered states) to group inner nodes together. This parent node can have a condition (same as an activator) which when satisfied, allows the chatbot access to instantly evaluate the child nodes (acting as a gateway essentially).

Any help/info is much appreciated!

Hi @CiaronHowell !
JAICF has an onlyIf feature that may help you
Unfortunately, there is no way to compose activation rules in a tree-like structure in JAICF, but you can customize all of your intent rules separately to activate only if there is a property in a context
Hope it helps!

Ah right, that's fair enough. The main reason for asking about this functionality is that it would reduce a lot of duplicated code for checking the condition.

Do you think this "continue and evaluate children" functionality could be added as a reaction method?

I'd support Ciaron's request here, but I think Ciaron is referring to Watson's 'Folders' which simply exist to 'unlock' a set of child nodes/states depending on a logical condition. A folder doesn't itself have a reaction/response, it just makes child nodes available for activation. We've built non-trivial dialogue models with Watson, and have found the Folders functionality a really useful abstraction to help model anaphora using context variables (e.g. 'lastTopic=painManagement') and it really helps build and mange complex flows. I think this would be a great addition to your DSL.

Thanks for the detailed explanation!

I agree that it would be a great feature, but I don't think something like that will be added in a near future, sorry...

There are several ideological reasons why we don't want to extend our DSL this way, also there are several technical reasons why it is hard to implement "continue and evaluate children" logic as a runtime feature too (e.g. as a reactions extension)
And in any case implementing such a feature will require us to greatly redesign JAICF base logic

As for now, I can only advice to use the onlyIf feature in order to customize activation logic based on context variables

fair enough, one to shelve for future perhaps. Best wishes.

Well explained @davidmeredith!

And in any case implementing such a feature will require us to greatly redesign JAICF base logic
That makes sense, for a 'nice to have' it'd be understandably difficult to justify it at this time!

Thanks again for your time @nikvoloshin.