Table of contents


Official Content

In order to create and initialize Chatbot Entity values (and their synonyms) in the AI provider, using the Chatbot generator, you just need to execute the following steps.

1. Create a Data Provider or procedure which loads into a Structured Data Type (SDT) object the list of values for the entity you want to load in the AI provider.

2. Call the "SendEntitiyValues" procedure (this procedure is an entry point which belongs to the Chatbot external module). In the Kb, you can see it under References - Chatbot/Entities module.

image_201951016424_1_png

Its signature is as follows:

parm(in:&ChatbotInstance, in:&EntityValues, in:&Entity, out:&Messages);

Where:

&ChatbotInstance
      Is varchar(256). The name of the Conversational Flows object.

&EntityValues
      Is of EntityValues data type. Load all the entity values and its synonyms here.

   image_201881113041_1_png

&Entity
      Is varchar(40). The name of the Entity in the NLP provider.

&Messages
      Is an output parameter of Messages data type. See Chatbot Generator common errors and solutions to have details about the values which can take the &Messages parameter.

Sample

Take a look at the example shown in HowTo: Build a chatbot using GeneXus, and open the "InitializeEntityValuesPrc" procedure.

In this example, you are sending values to the AI provider to load the "Social_Event_Type" entity and some synonyms for each of the values (the synonyms are not mandatory).

&SDTEntityValues.values.Clear()
&SDTEntitiesValuesValue.value = !"Art"
&SDTEntitiesValuesValue.synonyms.Add(!"Artistic")
&SDTEntityValues.values.Add(&SDTEntitiesValuesValue)

&SDTEntitiesValuesValue = new()
&SDTEntitiesValuesValue.value = !"Culture"
&SDTEntitiesValuesValue.synonyms.Add(!"Cultural")
&SDTEntityValues.values.Add(&SDTEntitiesValuesValue)

&SDTEntitiesValuesValue = new()
&SDTEntitiesValuesValue.value = !"Nature"
&SDTEntitiesValuesValue.synonyms.Add(!"Fresh air")
&SDTEntityValues.values.Add(&SDTEntitiesValuesValue)

&InstanceName = !"CitizenServiceSD"
Chatbot.Watson.SendEntitiyValues(&InstanceName,&SDTEntityValues,!"Social_Event_Type",&messages)
do "ProcessErrors"

After executing this procedure, consider that the AI takes a time to train the information.

Note: The entities are created in the Provider if they do not exist.

See Also

Chatbots in GeneXus

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant