Rasa_Sdk 3.6.0 (2023-06-13)
Deprecations and Removals
- #975: Drop support for Python 3.7 as it is approaching its end of life in June 2023.
Features
- #970: Add pluggy to provide ability to create sanic extensions in rasa-sdk
Improvements
-
#922: ## Problem
Rasa knowledge base actions cannot infer the object type of an object directly from the user message without the user first asking to list all objects related to that object type. This prevents action_query_knowledge from providing a suitable response when a user asks for a certain attribute of an object even though the knowledge base has the relevant information. That is, the knowledge base actions require the slotobject_type
to be set to one of the primary key values in the knowledge base for it to search through the objects. Here is an example:Your input -> what is the price range of Berlin Burrito Company? Sorry, I'm not sure I understand. Can you rephrase? Your input -> list some restaurants Found the following objects of type 'restaurant': 1: Gong Gan 2: I due forni 3: Pfefferberg 4: Lụa Restaurant 5: Donath Your input -> what is the price range of Berlin Burrito Company? 'Berlin Burrito Company' has the value 'cheap' for attribute 'price-range'.
Proposed solution
- The improvement requires changes to the classes ActionQueryKnowledgeBase and InMemoryKnowledgeBase under rasa-sdk.
- The
object_type
can be inferred by utilizing the entity extraction (DIET) where object types are used as entities to annotate object names.
This also requires changes to be made to slot management to enable dynamic inference ofobject_type
. - The scope of the suggested solution is limited to user queries where they ask for an attribute of a given object without mentioning the object type and without needing to first ask for a list of options of the corresponding object type.
- E.g.: If the user asks for ‘price range of Berlin Burrito Company’, then rasa will extract and set attribute slot value to ‘price-range’ and hotel slot value to ‘Berlin Burrito Company’. From this, it can be inferred that the user is talking about the object type ‘hotel’.
Summary of Changes
- To enable the inference of
object_type
using the entities the following changes were made to the existing code base:- Extract the list of object_types from our knowledge base using a new method
get_object_types()
instorage.py
for theInMemoryKnowledgeBase
class. - A new method named
match_extracted_entities_to_object_type()
was added inutils.py
to infer the object type of a given object using the entities and list of object types - The relevant logic was added in
actions.py
to infer the object type using the above functionalities when the object type slot is not set. - To enable dynamic inference of
object_type
, changes to slot management are also required. Currently, the change is to reset theobject_type
slot toNone
after every conversation turn.
- Extract the list of object_types from our knowledge base using a new method