How to get QnA working?


#1

Hi everyone! I have a fresh bot running and installed @botpress/builtins @botpress/nlu @botpress/qna. My goal is to have a set of questions and answers, and when the bot can’t find the answer, wait for a human to respond.

I can add questions and answers in the dashboard qna module, but when I type in the exact question, nothing happens. How do I get QNA to actually do something?

Cheers, Carl


#2

@rwprodev, are you getting any errors in console? Can you provide me with it’s output?
Also, can you check “Middlewares” tab in admin panel: is botpress-qna middleware enabled?


#3

Same here!

I’m using the latest version available (10.46.0). Qna middleware appears in the list of middlewares, just after that of NLU. Should I do something else?

I have only created questions and answers from the GUI. I tried with exact questions and nothing happens. Any ideas?


#4

Are you getting any error in the terminal or client-console?


#5

No, I don’t have errors, nor any clues in the console.


#6

I’ve tried to reproduce an error locally like this:

  1. I’m initializing new bot
  2. I’m adding qna module
  3. In qna-module I add an item with “What’s the weather today?” question and “It’s fine today” answer.
  4. I wait a few seconds till NLU is synced
  5. I type in “What’s the weather today?” and bot responds with “It’s fine today”

@lmoralejo, @rwprodev, it could happen that for some reason your question doesn’t get recognized by NLU. Could you retest on botpress 10.46.4?


#7

I am seeing the issue with 10.46.5, here is the log:

02:16:25 - info: [NLU::Rasa] Synced model [Model=model_20181010-021624]
02:17:19 - error: QnA Error TypeError: _this2.storage.fetchQuestions is not a function
    at Object._callee5$ (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:160:47)
    at tryCatch (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:191)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:437
    at new Promise (<anonymous>)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:99
    at filterByCategoryAndQuestion (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:62:33)
    at Object._callee6$ (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:197:36)
    at tryCatch (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:191)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:437

#8

Hi @Haythamamin! As far as I know, the categories are loaded from the configuration file as qnaCategories
(Comma-separated list of categories to use within QNA-module). Maybe that can help you.


#9

Hi guys,
I still can not walk QnA. I downloaded the module to understand what happens. What I found is that in middleware.js, it does the following:
const id = event.nlu.intent.name.substring (NLU_PREFIX.length);

I checked it and in the storage, they are generated with a random prefix. For example:

   "id": "3ow9xm6ila_preguntaNombre",
   "data": {
     "questions": [
       "preguntaNombre"
     ], ...

The prefix '3ow9xm6ila_' is generated automatically, it is not entered by the user. Is it configured with some variable that I am omitting?

If I force the id to '3ow9xm6ila_preguntanombre' in the middleware line, the module works fine.

In short, the module does not work for me because it does not find the question by Id.

How can I solve it? What am I doing wrong?


#10

OK! This solves the Categories issue, thanks! Still there is an error with QnA module as mentioned above.


#11

Hi! Do you have any news about this post? Is there any direct communication channel? Sorry, but I still can’t make work the QNA module…


#12

Hi, could you share your repository for me to try out your configuration?


#13

Thanks, Alex!

I will try to get access. I will consult with my client.

Anyway, could you clarify two things?
1- Is it okay for the id of the questions to be saved with a random prefix? For example: “3ow9xm6ila_questionName”, when I only entered “questionName”.
2- If it is good that this is so, could you explain why you are looking for it like this (Code below) and do not take into account the prefix?
const id = event.nlu.intent.name.substring (NLU_PREFIX.length);

Maybe you are clarifications, help me solve the problem.

Thanks!


#14

It’s fine that intent-names have prefix.
This prefix isn’t random - it’s an id of a QNA-item which is used to fetch it.


#15

How does the qnaQuestions filter work? Any idea?


#16

Do you mean filter available in the admin-ui?


#17

Yes @alex! The one across from the category one. Also, the category filter does not preform its intended task.


#18

@Haythamamin, I’ve just tested those filters on my installations and they seem to work fine. Could you specify which issues you are facing and how to reproduce them?


#19

Sure! Im running Botpress 10.50.0 and here are the errors I get in the console:

I get the following error when I try to select a category or try to filter the questions:

17:01:33 - error: QnA Error TypeError: storage.fetchQuestions is not a function
    at Object._callee5$ (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:161:42)
    at tryCatch (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:191)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:437
    at new Promise (<anonymous>)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:99
    at filterByCategoryAndQuestion (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:63:33)
    at Object._callee6$ (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:198:36)
    at tryCatch (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:191)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:437
    at new Promise (<anonymous>) TypeError: storage.fetchQuestions is not a function
    at Object._callee5$ (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:161:42)
    at tryCatch (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:191)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:437
    at new Promise (<anonymous>)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:99
    at filterByCategoryAndQuestion (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:63:33)
    at Object._callee6$ (/usr/share/botpress/node_modules/@botpress/qna/bin/webpack:/src/index.js:198:36)
    at tryCatch (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/usr/share/botpress/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:191)
    at /usr/share/botpress/node_modules/@botpress/qna/bin/node.bundle.js:671:437
    at new Promise (<anonymous>)

#20

it might have been fixed in 11, but I cant migrate to 11. Actually I have lots of feelings about the new version XX.