In custom knowledgebase how to infer object type from attribute

Using the example training data for the knowledgebase, I’m trying to understand how I can avoid having the object type included in the intent.

eg. Instead of::

- list [German](cuisine) [restaurants](object_type:restaurant)
- do you have any [mexican](cuisine) [restaurants](object_type:restaurant)?

Just be able to have::

- list [German](cuisine) 
- do you have any [mexican](cuisine)?

I want to be able to infer that cuisine is an object type restaurant and do a lookup on restaurants with attribute cuisine German/mexican.

Or do I need to change the way I’m approaching this problem?

Hi @phoebebright, the current solution around knowledge base uses slots to construct the query that is then used to fetch the relevant information from the knowledge base. Always the most recent value of the slot type is used to construct the query. If you don’t provide the object type in the user message itself, the slot object_type will not be set and the KnowledgeBaseAction fails to construct the query. If you want to add a custom mapping that checks if a certain slot is set and refers to another type of slot, I guess you can customize your KnoweldgeBaseAction. You could add a mapping at the top of the run method that checks the set slots and infers if another slot can be set or not.

FYI: We are currently looking into this feature again and trying to find a way to make it more flexible and easier to use. If you have some more details to share, I would be happy to jump on a quick call with you and discuss any problems you ran into so far. If you are interested just write me a private message. Thanks.

1 Like

Continuing the discussion from In custom knowledgebase how to infer object type from attribute:

Thanks for replying @Tanja . I have a rather hacking solution to this but would be delighted to have a call.

I don’t seem able to send a private message!