This site is no longer updated.Go to new Conversational Cloud docs

$caila.inference


Classifies the text with additional parameters:

Syntax

The method accepts the text for parsing in the string argument and some additional parameters:

$caila.inference({"phrase":{"text":"greetings"}, "nBest": 5, knownSlots: [{"name":"a", "value":"b"}]})

Here:

  • phrase are the phrases for classification.
  • nBest is the number of hypotheses to be returned.
  • knownSlots are the known slots:
    • name – name of the slot;
    • value – value of the slot.

A JSON object with the phrase classification result is returned in response.

Let us define the hello intent with the following training phrases: hello, hi. The classification result for the hello phrase is:

{
   "phrase":{
      "text":"hello",
      "entities":[

      ]
   },
   "variants":[
      {
         "intent":{
            "id":12174,         // intent id
            "path":"/hello",    // the path to the intent
            "slots":[           // slots

            ]
         },
         "confidence":1,       // confidence level
         "slots":[

         ]
      }
   ]
}

You can also use the custom clientId identifier as a method argument. Specify the clientId identifier as the last argument. When $caila.inference is executed, entities will be recognized for the specified client.

How to use

    state:
        q!: inference
        script:
            $reactions.answer(JSON.stringify($caila.inference({"phrase":{"text":"hello"}, "nBest": 5, knownSlots: [{"name":"a", "value":"b"}]})));