HowTo: Manage training examples using the Chatbot Generator API

Official Content
This documentation is valid for:

The Chatbot generator API allows you to Initialize entity values in the AI provider, and also adds the possibility to keep the training phrases (examples) for the intents recognition updated in the Provider.

The training examples are called Trigger Messages at the Conversational Flows instance, and they can be configured from the Trigger Messages property of each Flow.
Besides configuring the training examples there, they can be obtained, added and deleted, using the Chatbot Generator API (to avoid editing the Conversational Flows instance to make any change at production time).

This document details the methods to be used:

SendFlowTriggers

It allows you to send to the NLP Provider some triggers for a specific Flow.

Chatbot.Flows.SendFlowTriggers(&Instance, &Triggers, &Flow, &Messages)

where

  • &Instance is Character
  • &Triggers is a Varchar collection
  • &Flow is Character
  • &Messages is Messages data type. See Chatbot Generator common errors and solutions to have details about the values which can take the &Messages parameter.

Example

&Triggers.Add(!"rides at no cost")
&Triggers.Add(!"Free journey") 
        
&Flow = !"FreeTrips" //Name of the Flow
&Instance = !"Citizen" //Name of the instance
Chatbot.Flows.SendFlowTriggers( &Instance, &Triggers, &Flow, &Messages)

GetFlowTriggers

Returns a collection of Triggers of a particular Flow.

Chatbot.Flows.GetFlowTriggers(&Instance, &Flow, &Messages, &Triggers)

Example

&Flow = !"FreeTrips" //Name of the Flow
&Instance = !"Citizen" //Name of the instance
&Triggers = Chatbot.Flows.GetFlowTriggers(&Instance, &Flow, &Messages)

DeleteFlowTriggers

Deletes a collection of Triggers of a Flow.

Chatbot.Flows.DeleteFlowTriggers(&Instance, &Triggers, &Flow, &Messages)

Example

&Provider = Chatbot.Conversational.Watson
&Flow = !"FreeTrips" //Name of the Flow
&Instance = !"Citizen" //Name of the instance
&Triggers.Add(!"rides at no cost")
Chatbot.Flows.DeleteFlowTriggers(&Instance, &Triggers, &Flow, &Messages)

 

 

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.