Skip to main content

$caila

The built-in $caila service allows you to access NLU and client entities from the bot script.

NLU

The following methods make available the NLU core utilities for natural language processing and understanding, e.g. intent and entity recognition, word inflection, and language identification.

MethodDescription
cdqaQueryRetrieve excerpts from a CDQA document.
markup
markupWithToken
Markup of the argument text.
getEntity
getEntityWithToken
Retrieval of all the values set for the entity.
entitiesLookup
entitiesLookupWithToken
Search for entities in the argument text.
simpleInference
simpleInferenceWithToken
Text classification without additional parameters.
inference
inferenceWithToken
Text classification with additional parameters.
detectLanguageText language detection.

Passing the API key

Most of the methods above have analogous methods with a WithToken suffix, e.g. markupWithToken, entitiesLookupWithToken.

These methods work the same but accept an additional last argument: the NLP Direct API key.

tip
Use the WithToken methods rather than their regular counterparts when the bot and the trained classifier intended for it exist in separate projects. In this case, the classifier API token must be passed explicitly.

Client entities

Client entities are entities that the client can personalize during their conversation with the bot. The contents of such entities are unique to every client and unaccessible to others.

The following methods can be used to manage the contents of client entities from the script.

MethodDescription
addClientEntityRecordsAdds a record for a certain client to existing records of an entity.
deleteClientEntityRecordsRemoves the records with the specified id for a certain client.
getClientEntityRecordsReturns the list of all the records of an entity for a certain client.
setClientEntityRecordsOverwrites all the records of an entity for a certain client.
setClientEntityRecordUpdates the record of an entity for a certain client.
setClientNerIdSets a custom clientId that is to be used later to parse text.
clearClientNerIdRemoves a custom clientId set by the $caila.setClientNerId method earlier.