# Knowledge Base Actions

Warning

This feature is experimental. We introduce experimental features to get feedback from our community, so we encourage you to try it out! However, the functionality might be changed or removed in the future. If you have feedback (positive or negative) please share it with us on the [forum](https://forum.rasa.com/).

- [Using `ActionQueryKnowledgeBase`](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#using-actionqueryknowledgebase)

- [Create a Knowledge Base](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#create-a-knowledge-base)

- [Define the NLU Data](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#define-the-nlu-data)

- [Create an Action to Query your Knowledge Base](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#create-an-action-to-query-your-knowledge-base)
- [How It Works](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#how-it-works)

- [Query the Knowledge Base for Objects](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#query-the-knowledge-base-for-objects)

- [Query the Knowledge Base for an Attribute of an Object](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#query-the-knowledge-base-for-an-attribute-of-an-object)

- [Resolve Mentions](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#resolve-mentions)
- [Customization](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#customization)

- [Customizing `ActionQueryKnowledgeBase`](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#customizing-actionqueryknowledgebase)

### Knowledge base actions enable you to handle the following kind of conversations:

A common problem in conversational AI is that users do not only refer to certain objects by their names, but also use reference terms such as “the first one” or “it”. We need to keep track of the information that was presented to resolve these mentions to the correct object.

In addition, users may want to obtain detailed information about objects during a conversation – for example, whether a restaurant has outside seating, or how expensive it is. In order to respond to those user requests, knowledge about the restaurant domain is needed. Since the information is subject to change, hard-coding the information isn’t the solution.

To handle the above challenges, Rasa can be integrated with knowledge bases. To use this integration, you can create a custom action that inherits from `ActionQueryKnowledgeBase`, a pre-written custom action that contains the logic to query a knowledge base for objects and their attributes.

You can find a complete example in `examples/knowledgebasebot` ( [knowledge base bot](https://github.com/RasaHQ/rasa/blob/master/examples/knowledgebasebot/)), as well as instructions for implementing this custom action below.

## [Using `ActionQueryKnowledgeBase`](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#id4)

### [Create a Knowledge Base](https://legacy-docs-v1.rasa.com/1.6.2/core/knowledge-bases/#id5)

The data used to answer the user’s requests will be stored in a knowledge base. A knowledge base can be used to store complex data structures. We suggest you get started by using the `InMemoryKnowledgeBase`. Once you want to start working with a large amount of data, you can switch to a custom knowledge base.

To initialize an `InMemoryKnowledgeBase`, you need to provide the data in a json file. The following example contains data about restaurants and hotels. The json structure should contain a key for every object type, i.e. `
