AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Function to get the last rule label

Hi, Is there any function to get the label of the last rule that succeeded without using incontext that search in the last 5.



  [ # 1 ]

Not sure this is what you are looking for, but :why will return the rule that just matched.

:show why always returns the rule that matched.


  [ # 2 ]

I actually need to get into another rules the label of the previous rule


  [ # 3 ]

I’m not understanding what you want. Many rules “succeed”.  One or more generate user output (depending on your control script- harry defaults to 1).  If in the current volley you want to know what rule generated output in the last volley,
then in a postprocessing topic you can retrieve the rule label of the volley and save it on a global variable, available for the next volley.


  [ # 4 ]

Thank you.
Exactly what I already do. This leads to put this global variable under each rule. This would make it easier if there is a function to return just the last rule used in a -1 level of the conversation. Apparently,  this is not available.


  [ # 5 ]

why are you putting a global variable under each rule? ^responseruleid given the response index will return the rule. You can get this from a postprocessing topic at the end of the volley, so no need to put data on each rule


  [ # 6 ]

To be more explicit, for example, I have in ~topic1

u: TESTA ( i am)
[yes][oh yes]

u: TESTB (you are)
[ok][I know]

And in ~topic2:

u: ($intent=TESTA why) don’t worry

u: ($intent=TESTB why) oh oh

In the control script, topic 2 is only accessible if topic 1 does not return a response. whySo the answer of in topic2 depends on the previous output of topic1. How to do that with responseruleid? Of course I have several answers for a rule in topic 1 and ^ incontext function is not appropriate in this case.



  [ # 7 ]

Back to understanding what you want…. you want to call topic1 which says answers and sets $intent to the label of the rule giving those answers.  HENCE in a postprocessing topic you can get the same rule label at the end of the volley, and set $intent to be that rule label there. You can choose to ONLY set $intent if the rule label comes from topic1. Or not.


  [ # 8 ]

Thank you Bruce. I got it


  login or register to react