Hosting NLU Servers
Botpress communicates with two services to work correctly: Duckling and a Language Server. If your Botpress installation has no internet access, you'll have to host these services on-prem. When following the different hosting methods, look for a section on on-prem hosting for further details.
Duckling
We use Duckling to extract system entities (time, email, currency, etc.). This service is very light and requires minimal resources.
Hosting Duckling on Linux and Mac
On these two Operating Systems, Duckling must be compiled. Therefore, you will need to install the software development tools and build from the source.
Please follow the instructions on the GitHub page of Duckling. We may provide some binaries in the future for common OS'.
Hosting Duckling on Windows
If you run Botpress on Windows, there is a .zip file available here.
Double-click on run-duckling.bat (the bat file sets the console's code page to UTF-8, then runs the executable). The folder zoneinfo includes the Olson timezones, which are already available by default on other OS.
Configuring your Chatbot
When you have successfully installed the duckling binary, edit the file data/global/config/nlu.json and set the parameter ducklingURL to where you run Duckling, for example, if it's on the same server as Botpress (and if you use the default port of 8000), you will set:
{
  ...
  "ducklingURL": "http://localhost:8000"
}
Language Server
The Language Server is used to provide the language models necessary to run the NLU. It is quite resource-intensive to host a language server due to the model sizes. To make it easy to get started, the default installation uses a Botpress-hosted Language Server. You can swap it out for your own (see below).
note
The NLU server is not the same as the language server, and uses the models provided by the language server.
By default, Botpress configures the Language Server to get 100 dimensions for words. If you plan to use that Language Server in production, we highly recommend setting the dimensions to 300 for a better vocabulary.
| Dimensions | RAM Usage | Disk Usage | 
|---|---|---|
| 100 | about 1.3 Gb | about 900 Mb | 
| 300 | about 3.5 Gb | about 3 Gb | 
All of this is per language.
Installing a Language Library
- Open this metadata file: https://botpress-public.nyc3.digitaloceanspaces.com/embeddings/index.json.
- Download the bpeandembeddingsfiles corresponding to your languages. For instance, for French, download thebp.fr.bpe.modelfile located underremoteUrland thebp.fr.300.binalso located underremoteUrl.
- Once the files are downloaded, place them somewhere on your server filesystem and take note of the path.
- Add the --offlineand the--dim < number >arguments to your command when starting the language server. i.e../bp lang --offline --dim <number> --langDir <some_path>. Ensure that the dimension argument matches the dimensions of the models you have downloaded, e.g.,bp.en.300.bin(Please note that you have to run this command in a directory that contains a functional copy of the Botpress binary).
note
300 is the number of dimensions the model has. More dimensions mean the model size is bigger. You can choose a lighter model if your server specs are limited, but keep in mind that you need to change the --dim parameter when you start the Language Server (e.g. ./bp lang --dim < number >).
| Abbreviation | Language | 
|---|---|
| ar | Arabic | 
| en | English | 
| fr | French | 
| ja | Japanese | 
| pt | Portuguese | 
| ru | Russian | 
| de | German | 
| es | Spanish | 
| he | Hebrew | 
| it | Italian | 
| nl | Dutch | 
| pl | Polish | 
Running your Language Server
The language server is embedded in Botpress and can be started using the command line. Here are the steps to run it and use it with your Botpress Server:
- Start the language server with ./bp lang.
- In data/global/config/nlu.json, changelanguageSources.endpointtohttp://localhost:3100.
- Restart Botpress and open the Languages page on the Admin.
- Install the desired languages your server should support.
- Restart the language server with parameters ./bp lang --readOnly.
note
ReadOnly prevents anyone from adding or removing languages and can only be used to fetch embeddings. There are additional parameters that can be configured (for example, to require authentication); you can see them by typing ./bp lang help.