How to stop repeating the original question by a validation action in a form activation

Hi,

I am looking for a way not to repeat the same question in a form loop if a validation code can ask a different question. For example, PTAL this (https://github.com/RasaHQ/rasa-2.x-form-examples/blob/main/05-validation/actions/actions.py).

class ValidateNameForm(FormValidationAction):
    def name(self) -> Text:
        return "validate_name_form"

    def validate_first_name(
        self,
        slot_value: Any,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: DomainDict,
    ) -> Dict[Text, Any]:
        """Validate `first_name` value."""

        # If the name is super short, it might be wrong.
        print(f"First name given = {slot_value} length = {len(slot_value)}")
        if len(slot_value) <= 2:
            dispatcher.utter_message(text=f"That's a very short name. I'm assuming you mis-spelled. Can I ask your first name again?")
            return {"first_name": None}
        else:
            return {"first_name": slot_value}

As you can see, I can ask in a different way if user input doesn’t fit the validation condition. However, we may get the repeating question from the orginal one - “What is your first name?”; as a result, a bot will say:

That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again? What is your first name?

Is there any way to let the bot say just the response from the validation action? Any help would be greatly appreciated. Thanks.

@miner I not get you what you want? sorry can you give some scenario?

Good to see you, nik202! It’s related to action_loop things. If an input cannot meet the condition set from a validation action, we get a re-asking response from “utter_ask_[slot]” (What is your first name?) as well as the response from the validation (That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again?). I want to skip “utter_ask_[slot]” for the second turn.

@miner if the slot value is less then 2 then you returning the default message and if the slot_value is met then you returning the slot_value i.e the name.

Share me the rule or stories file, me still confused what you up to, apologises in advance.

No worries at all! Sorry for the unclear question.

slots:
  first_name:
    type: text

forms:
  name_form:
    first_name:
    - type: from_text

responses:
  utter_ask_first_name:
  - text: What is your first name?

- story: test story
  steps:
  - intent: greet
  - action: utter_greet
  - intent: request_names
  - action: name_form
  - active_loop: name_form
  - slot_was_set:
    - requested_slot: first_name
  - slot_was_set:
    - requested_slot: null
  - active_loop: null

With this setting, if a user say like:

user: hi
bot: good to meet you!
user: let me tell you my name
bot: What is your first name?
user: vh
bot: That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again?
bot: What is your first name? // want to stop this

Thanks!

@miner Right, then what is the significance of validating the input, this process is right, but you don’t want that it will asked the same question second time? i.e what is your first name, rather then your will again input the right value greater then 2 and it will display the first name right?

Yep. The point here is not about the validation condition as described here, though. Put it simple, I want to stop ‘utter_ask_first_name’ response for the validation turn.

@miner Right! Just only want this message “That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again?” thats it.

Yep!

@miner

I have dry run the code:

That what you expecting?

user: hi
bot: good to meet you!
user: let me tell you my name
bot: What is your first name?
user: vh
bot: That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again?
bot: Ok.Thanks!
bot: I will remember thats your name is vh

If the user even mention the two string or

user: vh
bot: That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again?
user: nik
bot: Ok.Thanks!
bot: I will remember thats your name is nik

Which scenario you want?

Cannot be better! Second one.

user: vh
bot: That’s a very short name. I’m assuming you mis-spelled. Can I ask your first name again?
user: nik
bot: Ok.Thanks!
bot: I will remember thats your name is nik

@miner ok!

Any solution for this problem?