Having access to the output node’s ids (otherwise known as output ids) can be quite useful when, for example, testing a chatbot. If a chatbot has multiple answer variations, you can evaluate the response based on its output id instead of every answer text variation.
The following post-processing script will add an output parameter with the output id’s to Teneo’s engine response:
def list = _.processingPath.findAll{it.type=="output" && !it.skipped}.vertexId
def outputIds = list.toString()
if (outputIds) outputIds = outputIds.substring(1,outputIds.length()-1)
if(_.getApplicationName() != 'app') {
_.putOutputParameter('OUTPUT_NODE_IDS',outputIds)
}
The script works like this:
- A user traverses an output node
- The script takes the output id of that node and adds it as an output parameter
- The output id is then available in the published engine response
Since the output id is available, we can evaluate the bot’s response in a chatbot testing tool, like Botium!