Skip to main content

CDQA skills


The CDQA (Closed Domain Question Answering) is a question answering system based on machine learning. You can upload a text file to it, and the bot can use excerpts from this file to answer user questions.

If you would like to enable the CDQA beta version, contact your account manager or send us a message at

To start working with the CDQA:

  1. Create the CDQA in your project.
  2. Connect the CDQA to the script.

Create the CDQA

  1. Go to the necessary project.

  2. Select Knowledge base on the control panel.

  3. If the knowledge base already contains modules, click Add module on the tab bar.

  4. Select CDQA and configure the module:

    • Enter the CDQA name.
    • Select the document language: Russian and English or other languages.
    • Upload the document where the bot should retrieve answers from.
    Document file requirements: TXT format, UTF-8 encoding, size up to 1 MB.
  5. Select Add module.

Knowledge base menu after adding the CDQA

Connect the CDQA to the script

  1. Go to the knowledge base menu.
  2. Find the CDQA module and click next to it → Copy the module code.
  3. Select EditorCode on the control panel.
  4. Paste the code you’ve copied at the end of the script. Here’s how it looks:
state: NoMatch
event!: noMatch
var result = $caila.cdqaQuery($request.query, "CDQA.Our courses", 0.5);
if (result.predicted) {
} else {
$reactions.answer("I didn’t find the answer in my documents. Ask something else!");

This is a state where the bot will switch to by the noMatch event: when it cannot find the answer to a user’s question in FAQ modules or among other intents. In this state, the bot calls a special $caila.cdqaQuery method to retrieve the answer from the CDQA.

There should only be one state with event!: noMatch in the script. If a state like this already exists, either delete it or adapt its code to call $caila.cdqaQuery.

You can use response retrieval from the CDQA in any other place in the script. For example, if the user request is relevant to an FAQ module, the bot can look up an answer in the document and only use the default answer from the FAQ if it can’t find any:

state: FAQ.Education
intentGroup!: /KnowledgeBase/FAQ.Education
var result = $caila.cdqaQuery($request.query, "CDQA.Our courses", 0.5);
if (result.predicted) {
} else {