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(&Provider, &Triggers, &Flow, &Instance, &Messages)

where

  • &Provider is based on Conversational Domain.
  • &Triggers is a Varchar collection
  • &Flow is Character
  • &Instance is Character
  • &Messages is Messages data type

Example

&Provider = Chatbot.Conversational.Watson
&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(&Provider, &Triggers, &Flow, &Instance, &Messages)

GetFlowTriggers

Returns a collection of Triggers of a particular Flow.

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

Example

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

DeleteFlowTriggers

Deletes a collection of Triggers of a Flow.

Chatbot.Flows.DeleteFlowTriggers(&Provider, &Triggers, &Flow, &Instance, &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(&Provider, &Triggers, &Flow, &Instance, &Messages)

Availability

Since GeneXus 16 upgrade 1

 

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