Entities are extracted but the slots are not filled

I am desperate here, I create a simple form, which will ask the weight, send address and receive address then calculate the shipping fee. When I run rasa shell --debug, nlu model can detect entities correctly. However, the slots are not filled. I have imitated formbot example to write stories, actions, … but still not working

My actions.py file

from typing import Dict, Text, Any, List, Union, Optional

from rasa_sdk import Tracker, Action from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.forms import FormAction

class PriceForm(FormAction): def name(self) -> Text: “”“Unique identifier of the form”""

    return "price_form"

@staticmethod
def required_slots(tracker:Tracker) -> List[Text]:
    """A list of required slots that the form has to fill"""

    return ["from_address", "destination_address", "weight"]

def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
    """A dictionary to map required slots to
        - an extracted entity
        - intent: value pairs
        - a whole message
        or a list of them, where a first match will be picked
     """
    return {
    "from_address": self.from_entity(entity= "from_address", intent = "hoi_phi_giao_hang"),
    "destination_address": self.from_entity(entity= "destination_address", intent = "hoi_phi_giao_hang"),
    "weight": self.from_entity(entity= "weight", intent = "hoi_phi_giao_hang"), 
    }

def submit(
    self,
    dispatcher: CollectingDispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> List[Dict]:
    """Define what the form has to do after all required slots are filled """
    # utter submit template
    dispatcher.utter_template("utter_submit", tracker)
    return []

My stories file

happy hoi_phi_giao_hang

  • greet
    • utter_greet
  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
    • form{“name”: null}
    • utter_tinh_phi_giao_hang
  • thank
    • utter_thank
    • utter_additional_help
  • deny
    • utter_thank

contains("<!–") ## unhappy hoi_phi_giao_hang

  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
  • chitchat
    • utter_chitchat
    • price_form
    • form{“name”: null}
    • utter_tinh_phi_giao_hang
  • thank
    • utter_thank contains("–>")

very unhappy hoi_phi_giao_hang

  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
  • chitchat
    • utter_chitchat
    • price_form
  • chitchat
    • utter_chitchat
    • price_form
  • chitchat
    • utter_chitchat_2
    • price_form
    • form{“name”: null}
    • utter_tinh_phi_giao_hang
  • thank
    • utter_thank

stop but continue hoi_phi_giao_hang

  • greet
    • utter_greet
  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
  • deny
    • utter_ask_continue
  • affirm
    • price_form
    • form{“name”: null}
    • utter_tinh_phi_giao_hang
  • thank
    • utter_thank

stop and really stop path

  • greet
    • utter_greet
  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
  • deny
    • utter_ask_continue
  • deny
    • action_deactivate_form
    • form{“name”: null}

chitchat stop but continue path

  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
  • chitchat
    • utter_chitchat
    • price_form
  • deny
    • utter_ask_continue
  • affirm
    • price_form
    • form{“name”: null}
    • utter_tinh_phi_giao_hang
  • thank
    • utter_thank
    • utter_additional_help
  • deny
    • utter_goodbye

stop but continue and chitchat path

  • greet
    • utter_greet
  • hoi_phi_giao_hang
    • price_form
    • form{“name”: “price_form”}
  • deny
    • utter_ask_continue
  • affirm
    • price_form
  • chitchat
    • utter_chitchat
    • price_form
    • form{“name”: null}
    • utter_tinh_phi_giao_hang
  • thank
    • utter_thank

My domain file:

intents:

  • affirm
  • deny
  • greet
  • help
  • goodbye
  • thank
  • swearing
  • kiem_tra_don
  • giuc_giao_hang
  • chitchat: use_entities: []
  • hoi_phi_giao_hang: use_entities: []
  • buu_cuc_gan_nhat
  • dang_ki

entities:

  • date
  • order_code
  • weight
  • from_address
  • destination_address
  • email
  • phone_number
  • local_address

slots: order_code: type: unfeaturized auto_fill: False weight: type: unfeaturized auto_fill: False from_address: type: unfeaturized auto_fill: False destination_address: type: unfeaturized auto_fill: False requested_slot: type: unfeaturized

templates: utter_ask_continue: - text: “Bạn có muốn tiếp tục ko ?” utter_ask_from_address: - text: “Vui lòng nhập địa chỉ gửi hàng?” utter_ask_destination_address: - text: “Vui lòng nhập địa chỉ giao hàng?” utter_ask_weight: - text: “Vui lòng nhập cân nặng?” utter_chitchat: - text: “Bạn có cần giúp gì liên quan đến đơn hàng, đăng kí và giao hàng nữa không ạ ?” utter_chitchat_2: - text: “I said stop fucking aroung, are you deaf ?. If you are not well educated enough to understand it let me translate it for you since I’m a nice bot\nBạn có cần giúp gì liên quan đến đơn hàng, đăng kí và giao hàng nữa không ạ ?” utter_calculating: - text: “Calculating…” utter_greet: - text: “Chào bạn! Tôi là chatbot của GHTK” utter_help: - text: “Bạn muốn GHTK trợ giúp điều gì?” utter_additional_help: - text: “Bạn muốn GHTK trợ giúp điều gì nữa không ạ?” utter_goodbye: - text: “GHTK rất vui được phục vụ bạn. Tạm biệt!” utter_thank: - text: “Hihi :smiley: . Không có gì!” utter_swearing: - text: “Watch your language :pensive::pensive::pensive:” utter_kiem_tra_don:

  • text: “GHTK đã ghi nhận mã đơn {order_code}. Nhưng thật tiếc chức năng vẫn chưa hoàn thiện!” utter_giuc_giao_hang:
  • text: “GHTK đang hoàn thiện chức năng giục giao hàng. Bạn thông cảm!” utter_tinh_phi_giao_hang:
  • text: “GHTK xác nhận tính phí giao hàng dựa những thông tin sau: \n - địa chỉ gửi: {from_address}\n - địa chỉ nhận: {destination_address}\n - cân nặng: {weight}\n” utter_buu_cuc_gan_nhat:
  • text: “GHTK đang hoàn thiện chức năng tìm bưu cục tại địa điểm {local_address}. Bạn thông cảm!” utter_dang_ki:
  • text: “GHTK đang hoàn thiện chức năng đăng kí. Bạn thông cảm!” utter_ask_order_code:
  • text: "Bạn vui lòng cung cấp mã đơn gồm 9 chữ số: " utter_submit:
  • text: “Hoàn tất” utter_wrong_order_code:
  • text: “Mã đơn có gì đó sai sai”

actions:

  • utter_greet
  • utter_help
  • utter_goodbye
  • utter_thank
  • utter_chitchat
  • utter_swearing
  • utter_kiem_tra_don
  • utter_giuc_giao_hang
  • utter_buu_cuc_gan_nhat
  • utter_dang_ki
  • utter_tinh_phi_giao_hang
  • utter_ask_order_code
  • utter_ask_weight
  • utter_ask_from_address
  • utter_ask_destination_address
  • utter_submit
  • utter_wrong_order_code
  • utter_calculating
  • utter_additional_help
  • utter_ask_continue
  • utter_chitchat_2

forms:

  • price_form

My config file:

language: “vi”

pipeline:

  • name: “nlu.tokenizers.whitespace_tokenizer.WhitespaceTokenizer”
  • name: “RegexFeaturizer”
  • name: “CRFEntityExtractor”
  • name: “EntitySynonymMapper”
  • name: “CountVectorsFeaturizer” analyzer: ‘char’ min_df: 1 max_df: 1.0 min_ngram: 1 max_ngram: 5
  • name: “EmbeddingIntentClassifier” “epochs”: 10 policies:
    • name: FallbackPolicy
    • name: MemoizationPolicy
    • name: KerasPolicy “epochs”: 10
    • name: FormPolicy
    • name: MappingPolicy

Hey @TQuy. Happy to help! First of all, great job on phrasing the question right and providing so much info (files you used to build your bot) - it makes so much easier to jump in and see where the issue might hide :slight_smile:

So I think your slots are not being filled because in your domain file your have auto_fill: False for pretty much all your slots. This means that even though the entities are extracted the values are not automatically used to fill in the slot with the same name as entity. Try removing this from all slots that should be automatically filled (or set it to True) and see if that resolves an issue :slight_smile:

After changing auto_fill: true The slots are filled image , but then action_fallback is called and all the slots are empty again

In addition, there is warning coming from some where else which I belive they either belong to the old one or the training data from the other rasa project folders

can you help me this one, too? Thank you.

Hi @TQuy,

your story file is malformed so I think it is no wonder that the system can’t learn some of the paths properly.
Please remove those “contains("<!–")” artifacts and retrain your model.

See if the system then again sais: “There is no memorized next action”. If so, please post the whole conversation here, such that we can analyze what happened.

Regards Julian