Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

17 lines (12 sloc) 675 Bytes
from rasa_sdk.knowledge_base.storage import InMemoryKnowledgeBase
from rasa_sdk.knowledge_base.actions import ActionQueryKnowledgeBase
class ActionMyKB(ActionQueryKnowledgeBase):
def __init__(self):
# load knowledge base with data from the given file
knowledge_base = InMemoryKnowledgeBase("knowledge_base_data.json")
# overwrite the representation function of the hotel object
# by default the representation function is just the name of the object
knowledge_base.set_representation_function_of_object(
"hotel", lambda obj: obj["name"] + " (" + obj["city"] + ")"
)
super().__init__(knowledge_base)
You can’t perform that action at this time.