Knowledge Bases - confused about how to reference a specific object_type

In the documentation for the Knowledge Base, there are a lot of examples given, but none of them seem able to directly reference an item in the list.


- what [restaurants]{"entity": "object_type", "value": "restaurant"} can you recommend?

This will return a list of all the restaurants in the database. Cool. Got it.

But what if I don’t want to see a list first? What if I want to directly reference a restaurant?

If I set object_type to Mike’s Pizza, the action fails because it’s looking for the TYPE ‘Mikes Pizza’, but Mikes Pizza is an entry under the type of restaurant. There is no type ‘marks pizza’.

But the docs seem to address this with the example:

- what is the [price range]{"entity": "attribute", "value": "price-range"} of [Berlin Burrito Company](restaurant)?

So I tried to emulate that, and instead of setting the slot object_type, I set the slot restaurant.

But that fails - action_query_knowledge_base has no object_type sent to it, so it instead issues one of the rephrase utterances. I’ve tried this. Setting restaurant, without object_type being set, returns nothing.

Might be possible if you can set a slot along with an intent without actually tagging a word to go into that slot. No clue how to do that though.

With the knowledge base, it seems like the ONLY way to reference Mike’s Pizza is to first get a list, then pick Mike’s pizza from it. Which is a dumb way to do it when you know which restaurant you want.

I HAVE to be missing something, but the documentation is… kinda garbage at actually explaining it.

I’m thinking what I’m missing is maybe object_type must be set to restaurant, BEFORE you do the Mikes Pizza query - but for my use case I need to set that transparently. I don’t want the user to have to write an extra line just to set it. But I cannot find anywhere that mentions setting a slot being tied to an intent without pulling that slot from the text the user entered.

EDIT: So in trying to understand this, I made a new bot, using the examples listed at Knowledge Base Actions

Used the json dataset provided, used the nlu examples for the intent query_knowledge_base, set up slots and actions and intents, trained, fired up Rasa-X, and started a conversation.

I asked: what restaurants can you recommend? It ran: query_knowledge_base{“object_type”:“restaurant”}(1.0)

I told it to run action_query_knowledge_base and it replied:

Found the following objects of type 'restaurant':
1: Donath
2: Berlin Burrito Company
3: I due forni

Cool, thats expected.

Next I asked, word for word from the NLU training:

what is the price range of berlin burrito company?
It ran: query_knowledge_base{"attribute":"price-range","restaurant":"berlin burrito company"}(1.0)
action_query_knowledge_base replied:
Could you please rephrase your message? I didn't quite get that.

It seems the ONLY WAY to work with a knowledge base is to extremely non-intuitively first ask for the list of items, then say something that selects ‘the first one’, and THEN once that is selected you can ask for info. Or ask for the ‘price range’ on ‘the second one’.

Am I experiencing brain damage/a stroke and I’m seriously misunderstanding how this works, or is the Knowledge Base Actions page completely wrong and no one has ever tested if it actually worked as intended? By looking at the KB code at, it appears that nowhere in that code is there any place where the NAME of the restaurant is used. The only things referenced are the object_type (restaurant) and a mention, which can ONLY be set by it’s ordinal number, and an attribute, like price range.

So it’s literally impossible to ask for the cuisine of Berlin Burrito Company, you have to ask for the cuisine of the second one. Sure you could set a synonym of 2 for the burrito place, but we already have the name. Why is it not able to use it? People don’t speak like that.

Imagine this bot is running for the company that owns Chilis. You log in.

What time does Chilis close tonight?

Bot: Rephrase that.

What restaurants do you have?

Bot: Gives a list

Ok, what time is chilis open til?

Bot: Rephrase that

God dammit, what time is THE FOURTH ONE open until.

Bow: 1am

Thats not how conversation works.

For feedback on the knowledge base, as I’m understanding it, it’s utterly worthless. Again I could have had a stroke and am seriously missing something, but following the documentation for it on the docs site… its completely broken.

But, I need this functionality so it appears I am re-writing the entire knowledge base actions ground up.

1 Like

So much thanks for your share. I thought it must be my mistake from where envs or running steps to make the bot keeps saying “Rephrase Rephrase Rephrase”. It suffers me three hours long at least.

I have read parts of the action code and it is really a simple use of “give your object and attribute and give me answer back” function.

rasa is a very good framework so it is nearly unbelievable for me to realize how tough to use this knowledge base.

same as you to reewrite the actions, but as least i know im not the only one :wink:

Share the same experience.

Me and my colleague spent a lot of time following the documentation, not getting it to work, thinking we’re doing something wrong.

Because I experienced little activity on Rasa Forums last few months, unfortunately just today I’ve searched for the knowledge base issue on both the internet and this forum.

So, this post helps me a lot, thank you!

I suggest thatsomeone with mandate should clarify that the documentation just gives hints and the examples are really examples. Including making clear what’s already implemented in ActionQueryKnowledgeBase and what does not work yet (f.e. getting the attributes when a user gives the object explicitly)

So, as I see it, knowledge bases integrating in your CAI is a great concept. Rasa did well to realise and document it.

But Rasa should consider, to skip the experimental state and document it as a starting point to create your own integrations CA and data; data either in RDBS, graph bases, documents(!), webpages(1) or whatsoever.

As I write this, I realize that’s what the blogs and documents aim at: encouraging the community to not only try it out, but also enrich it!