Query_knowledge_base won't work for me

try to implement this

Seems like it detects that - but won’t get me any answer…

here are the logs:

2021-01-20 13:45:05.065953: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library ‘libcudart.so.10.1’; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory 2021-01-20 13:45:05.065990: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2021-01-20 13:45:06.810139: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library ‘libcuda.so.1’; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory 2021-01-20 13:45:06.810177: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303) 2021-01-20 13:45:06.810208: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (cnvrg-job-notebooksession-hcah9k7qqbfrr4awxdbk-7bfcd8c5bb-nm46z): /proc/driver/nvidia/version does not exist 2021-01-20 13:45:06 INFO rasa.model - Loading model models/20210120-133638.tar.gz… 2021-01-20 13:45:07 DEBUG rasa.model - Extracted model to ‘/tmp/tmp6pbnprtt’. 2021-01-20 13:45:07 DEBUG urllib3.connectionpool - Starting new HTTPS connection (1): api.segment.io:443 2021-01-20 13:45:07 DEBUG urllib3.connectionpool - https://api.segment.io:443 “POST /v1/track HTTP/1.1” 200 21 2021-01-20 13:45:07 DEBUG rasa.cli.utils - Parameter ‘endpoints’ not set. Using default location ‘endpoints.yml’ instead. 2021-01-20 13:45:07 DEBUG rasa.cli.utils - Parameter ‘credentials’ not set. Using default location ‘credentials.yml’ instead. 2021-01-20 13:45:07 INFO rasa.model - Loading model models/20210120-133638.tar.gz… 2021-01-20 13:45:07 DEBUG rasa.model - Extracted model to ‘/tmp/tmpha4tw3ej’. 2021-01-20 13:45:07 INFO root - Connecting to channel ‘cmdline’ which was specified by the ‘–connector’ argument. Any other channels will be ignored. To connect to all given channels, omit the ‘–connector’ argument. 2021-01-20 13:45:08 DEBUG sanic.root - CORS: Configuring CORS with resources: {’/’: {‘origins’: [’’], ‘methods’: ‘DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT’, ‘allow_headers’: [’.’], ‘expose_headers’: ‘filename’, ‘supports_credentials’: True, ‘max_age’: None, ‘send_wildcard’: False, ‘automatic_options’: True, ‘vary_header’: True, ‘resources’: {’/*’: {‘origins’: ‘’}}, ‘intercept_exceptions’: True, ‘always_send’: True}} 2021-01-20 13:45:08 DEBUG rasa.core.utils - Available web server routes: /webhooks/rest GET custom_webhook_CmdlineInput.health /webhooks/rest/webhook POST custom_webhook_CmdlineInput.receive / GET hello 2021-01-20 13:45:08 INFO root - Starting Rasa server on http://localhost:5005 2021-01-20 13:45:08 DEBUG rasa.core.utils - Using the default number of Sanic workers (1). 2021-01-20 13:45:08 INFO rasa.model - Loading model models/20210120-133638.tar.gz… 2021-01-20 13:45:08 DEBUG rasa.model - Extracted model to ‘/tmp/tmpanil4dl_’. 2021-01-20 13:45:08 DEBUG urllib3.connectionpool - Starting new HTTPS connection (1): api.segment.io:443 2021-01-20 13:45:08 DEBUG urllib3.connectionpool - https://api.segment.io:443 “POST /v1/track HTTP/1.1” 200 21 2021-01-20 13:45:08 INFO root - Enabling coroutine debugging. Loop id 121113832. 2021-01-20 13:45:08 INFO rasa.model - Loading model models/20210120-133638.tar.gz… 2021-01-20 13:45:09 DEBUG rasa.model - Extracted model to ‘/tmp/tmpc4bv_ecq’. 2021-01-20 13:45:09 DEBUG rasa.utils.tensorflow.models - Loading the model from /tmp/tmpc4bv_ecq/nlu/component_5_DIETClassifier.tf_model with finetune_mode=False… 2021-01-20 13:45:09.267957: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2021-01-20 13:45:09.275067: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2999995000 Hz 2021-01-20 13:45:09.275416: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x6995d40 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-01-20 13:45:09.275440: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2021-01-20 13:45:09 DEBUG rasa.nlu.classifiers.diet_classifier - Following metrics will be logged during training: 2021-01-20 13:45:09 DEBUG rasa.nlu.classifiers.diet_classifier - t_loss (total loss) 2021-01-20 13:45:09 DEBUG rasa.nlu.classifiers.diet_classifier - i_acc (intent acc) 2021-01-20 13:45:09 DEBUG rasa.nlu.classifiers.diet_classifier - i_loss (intent loss) 2021-01-20 13:45:09 DEBUG rasa.nlu.classifiers.diet_classifier - e_f1 (entity f1) 2021-01-20 13:45:09 DEBUG rasa.nlu.classifiers.diet_classifier - e_loss (entity loss) 2021-01-20 13:45:10 DEBUG rasa.utils.tensorflow.models - Finished loading the model. 2021-01-20 13:45:10 DEBUG rasa.utils.tensorflow.models - Building tensorflow prediction graph… 2021-01-20 13:45:14 DEBUG rasa.utils.tensorflow.models - Finished building tensorflow prediction graph. 2021-01-20 13:45:14 DEBUG rasa.nlu.classifiers.diet_classifier - Failed to load model for ‘ResponseSelector’. Maybe you did not provide enough training data and no model was trained or the path ‘/tmp/tmpc4bv_ecq/nlu’ doesn’t exist? 2021-01-20 13:45:14 DEBUG rasa.core.tracker_store - Connected to InMemoryTrackerStore. 2021-01-20 13:45:14 DEBUG rasa.core.lock_store - Connected to lock store ‘InMemoryLockStore’. 2021-01-20 13:45:14 DEBUG rasa.model - Extracted model to ‘/tmp/tmpvd7ls97a’. /usr/local/lib/python3.6/dist-packages/rasa/shared/core/slots.py:268: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the ‘influence_conversation’ flag for slot ‘object_type’ instead. category=FutureWarning, /usr/local/lib/python3.6/dist-packages/rasa/shared/core/slots.py:268: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the ‘influence_conversation’ flag for slot ‘mention’ instead. category=FutureWarning, /usr/local/lib/python3.6/dist-packages/rasa/shared/core/slots.py:268: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the ‘influence_conversation’ flag for slot ‘attribute’ instead. category=FutureWarning, 2021-01-20 13:45:14 WARNING rasa.shared.core.domain - You are using an experiential feature: Action ‘action_query_knowledge_base’! > 2021-01-20 13:45:14 DEBUG rasa.utils.tensorflow.models - Loading the model from /tmp/tmpvd7ls97a/core/policy_1_TEDPolicy/ted_policy.tf_model with finetune_mode=False… 2021-01-20 13:45:14 DEBUG rasa.utils.tensorflow.models - Finished loading the model. 2021-01-20 13:45:14 DEBUG rasa.utils.tensorflow.models - Building tensorflow prediction graph… 2021-01-20 13:45:17 DEBUG rasa.utils.tensorflow.models - Finished building tensorflow prediction graph. 2021-01-20 13:45:17 DEBUG rasa.core.nlg.generator - Instantiated NLG to ‘TemplatedNaturalLanguageGenerator’. 2021-01-20 13:45:17 INFO root - Rasa server is up and running. Bot loaded. Type a message and press enter (use ‘/stop’ to exit): > Your input -> what restaurants can you recommend?
2021-01-20 13:45:38 DEBUG rasa.core.lock_store - Issuing ticket for conversation ‘e8585803498b49619d029bc1de4d6dcb’. 2021-01-20 13:45:38 DEBUG rasa.core.lock_store - Acquiring lock for conversation ‘e8585803498b49619d029bc1de4d6dcb’. 2021-01-20 13:45:38 DEBUG rasa.core.lock_store - Acquired lock for conversation ‘e8585803498b49619d029bc1de4d6dcb’. 2021-01-20 13:45:38 DEBUG rasa.core.tracker_store - Could not find tracker for conversation ID ‘e8585803498b49619d029bc1de4d6dcb’. 2021-01-20 13:45:38 DEBUG rasa.core.processor - Starting a new session for conversation ID ‘e8585803498b49619d029bc1de4d6dcb’. 2021-01-20 13:45:38 DEBUG rasa.core.processor - Policy prediction ended with events ‘[]’. 2021-01-20 13:45:38 DEBUG rasa.core.processor - Action ‘action_session_start’ ended with events ‘[<rasa.shared.core.events.SessionStarted object at 0x7fa3205a3278>, ActionExecuted(action: action_listen, policy: None, confidence: None)]’. 2021-01-20 13:45:38 DEBUG rasa.core.processor - Current slot values: object_type: None mention: None attribute: None knowledge_base_listed_objects: None knowledge_base_last_object: None knowledge_base_last_object_type: None 2021-01-20 13:45:39 DEBUG rasa.nlu.classifiers.diet_classifier - There is no trained model for ‘ResponseSelector’: The component is either not trained or didn’t receive enough training data. 2021-01-20 13:45:39 DEBUG rasa.nlu.selectors.response_selector - Adding following selector key to message property: default 2021-01-20 13:45:39 DEBUG rasa.core.processor - Received user message ‘what restaurants can you recommend?’ with intent '{‘id’: 7014255293810654798, ‘name’: ‘query_knowledge_base’, ‘confidence’: 0.9999454021453857}’ and entities '[{‘entity’: ‘object_type’, ‘start’: 5, ‘end’: 16, ‘confidence_entity’: 0.9352092146873474, ‘value’: ‘restaurant’, ‘extractor’: ‘DIETClassifier’, ‘processors’: [‘EntitySynonymMapper’]}]' 2021-01-20 13:45:39 DEBUG rasa.core.processor - Current slot values: object_type: restaurant mention: None attribute: None knowledge_base_listed_objects: None knowledge_base_last_object: None knowledge_base_last_object_type: None 2021-01-20 13:45:39 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 5 events. 2021-01-20 13:45:39 DEBUG rasa.core.policies.memoization - Current tracker state: [state 1] user intent: query_knowledge_base | user entities: (‘object_type’,) | previous action name: action_listen 2021-01-20 13:45:39 DEBUG rasa.core.policies.memoization - There is no memorised next action 2021-01-20 13:45:39 DEBUG rasa.core.policies.rule_policy - Current tracker state: [state 1] user text: what restaurants can you reccoment? | previous action name: action_listen 2021-01-20 13:45:39 DEBUG rasa.core.policies.rule_policy - There is no applicable rule. 2021-01-20 13:45:39 DEBUG rasa.core.policies.rule_policy - Current tracker state: [state 1] user intent: query_knowledge_base | user entities: (‘object_type’,) | previous action name: action_listen 2021-01-20 13:45:39 DEBUG rasa.core.policies.rule_policy - There is no applicable rule. 2021-01-20 13:45:39 DEBUG rasa.core.policies.ensemble - Made prediction using user intent. 2021-01-20 13:45:39 DEBUG rasa.core.policies.ensemble - Added DefinePrevUserUtteredFeaturization(False) event. 2021-01-20 13:45:39 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_2_RulePolicy. 2021-01-20 13:45:39 DEBUG rasa.core.processor - Predicted next action ‘action_default_fallback’ with confidence 0.30. 2021-01-20 13:45:39 DEBUG rasa.core.processor - Policy prediction ended with events ‘[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x7fa32058f8d0>]’. 2021-01-20 13:45:39 DEBUG rasa.core.processor - Action ‘action_default_fallback’ ended with events ‘[<rasa.shared.core.events.UserUtteranceReverted object at 0x7fa30879a710>]’. 2021-01-20 13:45:39 DEBUG rasa.core.processor - Current slot values: object_type: None mention: None attribute: None knowledge_base_listed_objects: None knowledge_base_last_object: None knowledge_base_last_object_type: None 2021-01-20 13:45:39 DEBUG rasa.core.processor - Predicted next action ‘action_listen’ with confidence 1.00. 2021-01-20 13:45:39 DEBUG rasa.core.processor - Policy prediction ended with events ‘[]’. 2021-01-20 13:45:39 DEBUG rasa.core.processor - Action ‘action_listen’ ended with events ‘[]’. 2021-01-20 13:45:39 DEBUG rasa.core.lock_store - Deleted lock for conversation ‘e8585803498b49619d029bc1de4d6dcb’. Your input ->

NLU.YML version: “2.0”

nlu:

  • intent: query_knowledge_base examples: |

    • what [restaurants]{“entity”: “object_type”, “value”: “restaurant”} can you recommend?
    • list some [restaurants]{“entity”: “object_type”, “value”: “restaurant”}
    • can you name some [restaurants]{“entity”: “object_type”, “value”: “restaurant”} please?
    • can you show me some [restaurants]{“entity”: “object_type”, “value”: “restaurant”} options
    • list German [restaurants]{“entity”: “sobject_type”, “value”: “restaurant”}
    • do you have any mexican [restaurants]{“entity”: “object_type”, “value”: “restaurant”}?
    • do you know the [price range]{“entity”: “attribute”, “value”: “price-range”} of that one?
    • what cuisine is it?
    • do you know what cuisine the [last one]{“entity”: “mention”, “value”: “LAST”} has?
    • does the [first one]{“entity”: “mention”, “value”: “1”} have [outside seating]{“entity”: “attribute”, “value”: “outside-seating”}?
    • what is the [price range]{“entity”: “attribute”, “value”: “price-range”} of Berlin Burrito Company?
    • what about I due forni?
    • can you tell me the price range of that restaurant?
    • what cuisine do they have?
  • intent: greet examples: |

    • hey
    • hello
    • hi
    • hello there
    • good morning
    • good evening
    • moin
    • hey there
    • let’s go
    • hey dude
    • goodmorning
    • goodevening
    • good afternoon
  • intent: goodbye examples: |

    • good afternoon
    • cu
    • good by
    • cee you later
    • good night
    • bye
    • goodbye
    • have a nice day
    • see you around
    • bye bye
    • see you later
  • intent: affirm examples: |

    • yes
    • y
    • indeed
    • of course
    • that sounds good
    • correct
  • intent: deny examples: |

    • no
    • n
    • never
    • I don’t think so
    • don’t like that
    • no way
    • not really
  • intent: mood_great examples: |

    • perfect
    • great
    • amazing
    • feeling like a king
    • wonderful
    • I am feeling very good
    • I am great
    • I am amazing
    • I am going to save the world
    • super stoked
    • extremely good
    • so so perfect
    • so good
    • so perfect
  • intent: mood_unhappy examples: |

    • my day was horrible
    • I am sad
    • I don’t feel very well
    • I am disappointed
    • super sad
    • I’m so sad
    • sad
    • very sad
    • unhappy
    • not good
    • not very good
    • extremly sad
    • so saad
    • so sad
  • intent: bot_challenge examples: |

    • are you a bot?
    • are you a human?
    • am I talking to a bot?
    • am I talking to a human?

DOMAIN.YML version: “2.0”

intents:

  • greet
  • goodbye
  • affirm
  • deny
  • mood_great
  • mood_unhappy
  • bot_challenge
  • query_knowledge_base

entities:

  • object_type
  • mention
  • attribute

slots: object_type: type: unfeaturized mention: type: unfeaturized attribute: type: unfeaturized

actions:

  • action_query_knowledge_base

responses: utter_greet:

  • text: “Hey! How are you?”

utter_cheer_up:

utter_did_that_help:

  • text: “Did that help you?”

utter_happy:

  • text: “Great, carry on!”

utter_goodbye:

  • text: “Bye”

utter_iamabot:

  • text: “I am a bot, powered by Rasa.”

utter_ask_rephrase:

  • text: “Sorry, I’m not sure I understand. Could you rephrase it?”
  • text: “Could you please rephrase your message? I didn’t quite get that.”

session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true

STORIES.YML version: “2.0”

stories:

  • story: happy path steps:

    • intent: greet
    • action: utter_greet
    • intent: mood_great
    • action: utter_happy
  • story: sad path 1 steps:

    • intent: greet
    • action: utter_greet
    • intent: mood_unhappy
    • action: utter_cheer_up
    • action: utter_did_that_help
    • intent: affirm
    • action: utter_happy
  • story: sad path 2 steps:

    • intent: greet
    • action: utter_greet
    • intent: mood_unhappy
    • action: utter_cheer_up
    • action: utter_did_that_help
    • intent: deny
    • action: utter_goodbye
  • story: knowledge base happy path steps:

    • intent: greet
    • action: utter_greet
    • intent: utter_greet
    • action: action_query_knowledge_base
    • intent: goodbye
    • action: utter_goodbye

ACTIONS.PY from rasa_sdk.knowledge_base.storage import InMemoryKnowledgeBase from rasa_sdk.knowledge_base.actions import ActionQueryKnowledgeBase

class MyKnowledgeBaseAction(ActionQueryKnowledgeBase): def init(self): knowledge_base = InMemoryKnowledgeBase(“data.json”) super().init(knowledge_base)

PUT DATA.JSON both at parent folder and in actions folder (wasn’t sure the running directory) { “restaurant”: [ { “id”: 0, “name”: “Donath”, “cuisine”: “Italian”, “outside-seating”: true, “price-range”: “mid-range” }, { “id”: 1, “name”: “Berlin Burrito Company”, “cuisine”: “Mexican”, “outside-seating”: false, “price-range”: “cheap” }, { “id”: 2, “name”: “I due forni”, “cuisine”: “Italian”, “outside-seating”: true, “price-range”: “mid-range” } ], “hotel”: [ { “id”: 0, “name”: “Hilton”, “price-range”: “expensive”, “breakfast-included”: true, “city”: “Berlin”, “free-wifi”: true, “star-rating”: 5, “swimming-pool”: true }, { “id”: 1, “name”: “Hilton”, “price-range”: “expensive”, “breakfast-included”: true, “city”: “Frankfurt am Main”, “free-wifi”: true, “star-rating”: 4, “swimming-pool”: false }, { “id”: 2, “name”: “B&B”, “price-range”: “mid-range”, “breakfast-included”: false, “city”: “Berlin”, “free-wifi”: false, “star-rating”: 1, “swimming-pool”: false }, ] }