Integrating Knowledge Base with RASA


I really enjoyed the 2 articles written by @Tanja but left me out in total ambiguity on how to design my chatbot for banks for example.

1- In order to fetch data from a backend system,it was recommended to use a GraphSQL type database. Of course, customers do not store their data in this kind of db. Therefore, should we build an integration layer based on Kafka Messaging or anything similar so that to keep the GraphSQL constantly updated by transactions coming from the actual backend system ?

2- Knowledge Base QnA aren’t they supposed to be based on static information. We feed the RASA with some QnA type documents and it is supposed to extract an excerpt of the answer that is very close to the question. Does RASA does this ? Is it recommended to use knowledge base based on data coming from back-end system that is constantly changing like balance of an account >

1 Like

Hi @maoun, thanks for your questions.

Regarding 1: You don’t have to use a graph database. If you already have your relational database in place, you can also use that. You just need to adapt the queries, e.g. connection layer to the database. We simply used the graph database as it is easier to express relations. Using an additional layer to keep the graph database up-to-date sound good, but comes with quite some effort as you basically have to maintain two systems. So, if possible just use whatever you already have. We recently also added Knowledge Base Actions to Rasa. They help you to get started integrating knowledge bases faster. Just take a look and see if that helps you.

Regarding 2: We are not able to extract phrases/text blocks from documents in order to answer questions. We don’t have anything like that on our agenda for now, but might be worth looking into.

1 Like

Thank you for your reply @Tanja ,

1- SO what you’re saying is that I can still use a normal relational DB and still get the benefits of the Knowledge Based simplicity in queries such as ordinal mention , resolving mentions, etc… ??

2- Concerning the FAQ Bot, which at first glance I thought the Knowledge Base was an API for a FAQ bot but turned out it was much much interesting than that…I think the other new feature that you brought along side the KB Actions are the Retrieval Actions which is also a feature that I think it would fit perfectly for a FAQ Bot but what we call FAQ bot , you call them Simple Questions (“Simple questions, or FAQs, should receive the same answer no matter what happened previously in the conversation”.)…that was a little bit confusing at first but now I know.

Many Thanks again and awaiting for your feedback on the first point,

Basically the database in the background does not really matter. The example code on GitHub (GitHub - RasaHQ/tutorial-knowledge-base: Integrating Rasa with a knowledge base to encode domain knowledge and resolve entities) as well as the new documentation (Knowledge Base Actions) can use an in memory knowledge base, which is basically a json file that is loaded on startup. The data is stored into a python dict and that dict is used as knowledge base, e.g. as data storage. Of course querying a python dict is different from querying a graph database or a relational database, however, the logic of the knowledge base actions remains the same. The “magic” of the knowledge base actions is the smart usage of slots. If you are using a different database, you have to implement the interface to query the database. But you can still reuse parts of the code. I recommend to read Knowledge Base Actions, it might help to understand it better.

1 Like

Thanks youu very much …Looks promising as a feature still in Beta. Don’t you dare remove it in the future …we can build cool stuff on top of it :slight_smile: :slight_smile: