External NLU Engines

Digital Agent native NLU runs on-premises and supports a finite set of languages. If you plan to develop chatbots in languages that Digital Agent does not support or if you want to use another NLU solution, then you'll need to set up a 3rd party NLU connector. To achieve this, we'll use the power of Digital Agent hooks).

Define Languages​

One use-case for a 3rd party NLU is to support more languages in addition to those handled by Digital Agent Native NLU. For Digital Agent to keep working correctly with an additional language (defining intents & content), you'll have to tell Digital Agent the new languages you want to support. To do so, open Digital.Agent.config.json and set the additionalLanguages property. Let's say we want to support Swedish and Norwegian, the configuration would look like the following:

{
  "additionalLanguages": [
    {
      "code": "sv",
      "name": "Swedish"
    },
    {
      "code": "no",
      "name": "Norwegian"
    }
  ]
}


Now that you're done, you can go in your chatbot config page and choose the language(s) you want your chatbot to support. Note that multilingual is a Digital Agent Enterprise License feature.

Sync NLU Data to 3rd Party​

This function lets you use the Digital Agent NLU interface to define your intents, entities, and slots. Intents and entities are stored as JSON in BPFS (formerly ghost) on the local filesystem or in the database.

To sync data, we need to listen to any intents/entities changes and persist the data to our 3rd party NLU (please go through the listening to file changes tutorial for more information). This way, when one edits intents or entities in the NLU UI, we get notified. We can do this with a Digital Agent after bot mount hook. You can use the code editor module to create hooks easily.

onFileChanged is called with the file name containing changes when a file is either created, edited or deleted. What we want to do now is to check if the change is relevant (e.g., change in intents/entities) and sync the data to your custom NLU.

Here you go; you can now still use the Digital Agent NLU UI to define your intents/entities and push training data to your NLU engine.

Use your 3rd Party NLU for Classification and Extraction​

We will use a similar strategy during prediction time. What we want to do is call our 3rd party NLU for each incoming user message. We will use a before incoming hook, executed when Digital Agent receives a user message. The code is not complex if you keep in mind that Digital Agent works with a precise data structure, so you'll need to map the response data of your NLU provider to the Digital Agent NLU data format. The hook will look like the following:

That's about it; you now have Digital Agent integrated with your 3rd party NLU.