# Integrating Knowledge Base with RASA

**URL:** <https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787>\
**Category:** Tutorials, Resources & Videos\
**Created:** [September 17, 2019, 4:57pm UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787 "2019-09-17T16:57:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maoun](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@maoun](https://forum.rasa.com/u/maoun)\
**Post date:** [September 17, 2019, 4:57pm UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787/1 "2019-09-17T16:57:13Z")

</div>

Hello,

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 \>

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [September 18, 2019, 8:37am UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787/2 "2019-09-18T08:37:52Z")

</div>

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](https://rasa.com/docs/rasa/core/knowledge-bases/) 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.

---

<div class="post-metadata">

**Author:** ![maoun](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@maoun](https://forum.rasa.com/u/maoun)\
**Post date:** [September 18, 2019, 1:51pm UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787/3 "2019-09-18T13:51:30Z")

</div>

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](https://rasa.com/docs/rasa/1.3.3/core/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,

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [September 18, 2019, 2:20pm UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787/4 "2019-09-18T14:20:21Z")

</div>

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](https://github.com/RasaHQ/tutorial-knowledge-base)) as well as the new documentation ([Knowledge Base Actions](https://rasa.com/docs/rasa/core/knowledge-bases/)) 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](https://rasa.com/docs/rasa/core/knowledge-bases/?_ga=2.43489637.1716991282.1568616856-6187419.1552916589), it might help to understand it better.

---

<div class="post-metadata">

**Author:** ![maoun](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@maoun](https://forum.rasa.com/u/maoun)\
**Post date:** [September 18, 2019, 4:31pm UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787/5 "2019-09-18T16:31:41Z")

</div>

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 🙂 🙂

---

<div class="post-metadata">

**Author:** ![Nik720](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik720/32/14747_2.png) [@Nik720](https://forum.rasa.com/u/Nik720)\
**Post date:** [May 28, 2021, 9:30am UTC](https://forum.rasa.com/t/integrating-knowledge-base-with-rasa/15787/6 "2021-05-28T09:30:38Z")

</div>

Hi @Tanja If I have nested JSON data will KB action still works for it?

Ex.

```
       {
  "start": {
    "id": "start",
    "text": "Starting message",
    "WA_text": "",
    "children": [
      {
        "id": "course",
        "title": "Course",
        "payload": "/parent_entity{\"object\": \"course\"}",
        "children": {
          "text": "Select what you are looking for",
          "children": [
            {
              "id": "CRS_take",
              "title": "Take a course",
              "payload": "/parent_entity{\"object\": \"CRS_take\"}",
              "children": {
                "text": "Select the course you would like to take",
                "children": [
                  {
                    "title": "State Course",
                    "payload": "/parent_entity{\"object\": \"CRS_state_course\"}"
                  },
                  {
                    "title": "Course 2",
                    "payload": "/parent_entity{\"object\": \"CRS_course_2\"}"
                  },
                  {
                    "title": "course 3",
                    "payload": "/parent_entity{\"object\": \"CRS_course_3\"}"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}
```
