Entity checking

HI I am new to RASA and my company wants to build a chatbot to sell a brand bag. for example user ask “I want to buy designated bag” it is fine
however, if user ask “I want to buy LV bag” it should not answer and fall back.

my question is that is there any ways to check a certain name eg. “designated”, “Stylish”. ONLY these 2 are accepted other than that all fall back to default.

I understand I can also put another intent to check “LV” bag but it is not feasible as there are thousand of brands.

Another question is why sometimes the out-of-scope question has so high score (>0.99)? or I set something wrong?

my condifg: I need to hand chinese and english

pipeline:
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
   - name: "JiebaTokenizer"
     model: "en_core_web_trf"
   - name: RegexFeaturizer
   - name: LexicalSyntacticFeaturizer
   - name: CountVectorsFeaturizer
   - name: CountVectorsFeaturizer
     analyzer: char_wb
     min_ngram: 1
     max_ngram: 4
   - name: DIETClassifier
     epochs: 100
   - name: EntitySynonymMapper
   - name: ResponseSelector
     epochs: 100
   - name: FallbackClassifier
     threshold: 0.7
     ambiguity_threshold: 0.01


# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
  - name: TEDPolicy
  - name: RulePolicy
    nlu_threshold: 0.7
    core_threshold: 0.1
    ambiguity_threshold: 0.01
    fallback_core_action_name: "action_default_fallback"
    fallback_nlu_action_name: "action_default_ask_affirmation"

thanks! Alex

Regarding the first question, you could use a categorical slot with values: designated, Stylish and other and use slot validation to confirm that the value is set to one of those three.

On the second question, you’ll need to look at the debug log. You can also run an nlu test with examples that cause the out of scope.

Thanks for your reply. For the 2nd question, ,I really feel strange.

This is my intent

- intent: bags_authentic
  examples: |
    - How can I tell if the designated bags or designated labels I bought are authentic?
    - What are the key indicators or features to look for to ensure the purchased designated bags or labels are genuine?
    - Are there any specific markings or serial numbers that can help in confirming the authenticity of the designated bags or labels?
    - Can you provide a guide or checklist to authenticate the designated bags or labels I purchased?
    - Are there any official certifications or holograms that should be present on the designated bags or labels to confirm their authenticity?
    - What steps can I take to verify the authenticity of the designated bags or labels before using them?

I ask “i am a resident, can I procure bags and lables?”

{'name': 'bags_authentic', 'confidence': 0.8615509271621704}

I have no idea why it has so high score and we cannot see any relationship between my questions and this intent.

Any ways can avoid this? I struggle many hours already. Thanks and appreciate any help! Alex

Regarding my first question now I write:

nlu.yml
- intent: ask_where_to_buy_designated_item
  examples: |
    - Where can we buy a [designated](designated_bag) bags?
    - Can you tell me where to purchase a [designated](designated_bag) bags?

rules.yml
- rule: Respond to where to buy designated bags
  steps:
  - intent: ask_where_to_buy_designated_item
  - action: respond_where_to_buy_designated_item 

domain.yml
entities:
  - designated_bag

slots:
  designated_bag:
    type: text
    influence_conversation: false
    mappings:
    - type: from_entity
      entity: designated_bag

actions.py

class RespondWhereToBuyDesignatedItem(Action):
    def name(self) -> Text:
        return "respond_where_to_buy_designated_item"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        print("call response")
        print(Text)
        designated_bag_entity = next(tracker.get_latest_entity_values("designated_bag"), None)
        print(tracker.get_latest_entity_values("designated_bag"))

        #if designated_bag_entity:
        if designated_bag_entity is not None:
            response = f"You can buy {designated_bag_entity} at our official store. Is there anything else I can help you with?"
        else:
            response = "I'm sorry, I can only provide information about designated bags. Is there anything specific you would like to know about designated bags?"

        dispatcher.utter_message(response)

        return []

no matter how I ask (with designated bags in my questions) it only shows “I’m sorry, I can only provide information about designated bags. Is there anything specific you would like to know about designated bags?”

what is wrong in my code?
Alex

Regarding the high confidence on bags_authentic it’s hard to fully answer without seeing the other intents but I think you should add more example utterances and make them shorter. You currently have 6 long examples, try 20+ shorter examples.

Also, should “i am a resident, can I procure bags and lables?” match another intent? If not, create an intent for procure_bags or out_of_scope and put appropriate examples in the other intents.

For the entity extraction issue, you also need many more example utterances in ask_where_to_buy_designated_item.

Thanks for your reply!

in fact I use chatgpt to generate different asking styles,am I wrong to do so? or should I use short examples instead?

usually how many is enough? I found that for example, “buy” is ok but “purchase” it cannot recognize, what can I do for this situation? Shoud I use Synonym?

Thanks! Alex