Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last utterance is filling slot in new form #7712

Closed
3 tasks
desmarchris opened this issue Jan 12, 2021 · 10 comments
Closed
3 tasks

Last utterance is filling slot in new form #7712

desmarchris opened this issue Jan 12, 2021 · 10 comments
Assignees
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/forms Issues focused around rasa forms effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@desmarchris
Copy link
Contributor

desmarchris commented Jan 12, 2021

Rasa version: 2.1.2

Rasa SDK version (if used & relevant): 2.1.2

Python version: 3.8.6

Operating system (windows, osx, ...): osx

Issue:
I have a form that finishes by asking for a size of shoe, filled with a number entity extracted using Duckling. After I submit this form, I kick off another form that asks a survey. The survey asks for a 1-5 rating and for open text feedback. What happens is that when the survey form is kicked off after the user gave their shoe size, the number extracted for shoe size also fills the rating slot, skipping this question. Example:

Your input ->  check inventory
I can help you find some shoes!
What color are you looking for?
Your input ->  blue
What size shoe would you like?
Your input ->  9
You're in luck! We have those in stock.
Is there any other feedback you can provide?

The last question is the second question in my form, showing that the first question (rating question) was skipped.

Bot is located here: https://github.com/RasaHQ/retail-demo

Enable squad definition of done

  • Determine if this is expected behaviour given configuration
  • If not, then fix the bug
  • Else, open an enhancement issue
@desmarchris desmarchris added type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. area:rasa-oss 🎡 Anything related to the open source Rasa framework labels Jan 12, 2021
@alwx alwx added the area:rasa-oss/forms Issues focused around rasa forms label Jan 27, 2021
@joejuzl joejuzl added the effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. label Apr 16, 2021
@wochinge
Copy link
Contributor

@ArjaanBuijk didn't you fix this in #7771 ?

@ArjaanBuijk
Copy link
Contributor

@desmarchris ,
Can you post the full debug log?
It sounds similar to #7771, but not exactly.

@ancalita
Copy link
Member

Hi @desmarchris , I've just had a go at a bot conversation using rasa shell --debug after going through all the steps in your README. I was not able to replicate the issue in my first conversation: after the questions about colour and shoe size I got this bot reply which seems to be expected behaviour:

You're in luck! We have those in stock.
? On a scale of 1-5, how would you rate your conversation today?

Could you please let me know what else I can try to replicate this issue?

@desmarchris
Copy link
Contributor Author

@ancalita yes sorry that's because I changed the order of the questions to get around it :) I have it on my to do list to rewrite how to replicate this.

@desmarchris
Copy link
Contributor Author

@ancalita try using this commit: https://github.com/RasaHQ/retail-demo/tree/05aeb3486dd995262799e3995570da2cefb27398

I just changed the order of the slot filling after this. Same steps apply

@ancalita
Copy link
Member

@desmarchris Thanks for sending this - I was able to replicate using this commit.

I noticed one thing in the domain.yml of this commit that I have a hunch might be causing this behaviour: there is only one number slot that gets used by both forms: product_stock_form and survey_form.
When I introduced a new slot rating and a new entity feedback_rating, the behaviour you flagged disappears.

Instead I have a new issue: although the survey_form gets activated after the product_stock_form, it reverts to action_listen because There was no action found to ask for slot 'rating' name to be filled.
Here's an extract of the debug log:

2021-04-29 11:24:50 DEBUG    rasa.core.policies.rule_policy  - There is a rule for the next action 'action_survey_start'.
2021-04-29 11:24:50 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_2_RulePolicy.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Predicted next action 'action_survey_start' with confidence 1.00.
2021-04-29 11:24:50 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'action_survey_start'.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Action 'action_survey_start' ended with events '[<rasa.shared.core.events.FollowupAction object at 0x14b744c40>, <rasa.shared.core.events.SlotSet object at 0x14f841430>]'.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Current slot values: 
	color: None
	email: None
	number: None
	rating: None
	open_feedback: None
	requested_slot: None
	verified_email: None
	survey_complete: None
	session_started_metadata: None
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Predicted next action 'survey_form' with confidence 1.00.
2021-04-29 11:24:50 DEBUG    rasa.core.actions.forms  - Activated the form 'survey_form'.
2021-04-29 11:24:50 DEBUG    rasa.core.actions.forms  - No pre-filled required slots to validate.
2021-04-29 11:24:50 DEBUG    rasa.core.actions.forms  - Validating user input 'UserUttered(text: 9, intent: inform, entities: 9 (Type: number, Role: None, Group: None), use_text_for_featurization: False)'.
2021-04-29 11:24:50 DEBUG    rasa.core.actions.forms  - Validating extracted slots: {}
2021-04-29 11:24:50 DEBUG    rasa.core.actions.forms  - Request next slot 'rating'
2021-04-29 11:24:50 DEBUG    rasa.core.actions.forms  - There was no action found to ask for slot 'rating' name to be filled.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Action 'survey_form' ended with events '[<rasa.shared.core.events.ActiveLoop object at 0x14b683be0>, <rasa.shared.core.events.SlotSet object at 0x14f841730>]'.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Current slot values: 
	color: None
	email: None
	number: None
	rating: None
	open_feedback: None
	requested_slot: rating
	verified_email: None
	survey_complete: None
	session_started_metadata: None
2021-04-29 11:24:50 DEBUG    rasa.core.policies.memoization  - Current tracker state:
2021-04-29 11:24:50 DEBUG    rasa.core.policies.memoization  - There is a memorised next action 'action_listen'
2021-04-29 11:24:50 DEBUG    rasa.core.policies.ted_policy  - TED predicted 'action_listen' based on user intent.
2021-04-29 11:24:50 DEBUG    rasa.core.policies.rule_policy  - Predicted 'action_listen' after loop 'survey_form'.
2021-04-29 11:24:50 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_2_RulePolicy.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 1.00.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2021-04-29 11:24:50 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'.
2021-04-29 11:24:50 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'd67271b0207e463e9b8bb62534243b22'.

I've also edited the custom actions SurveyStart and SurveySubmit to return SlotSet("rating", None) instead of SlotSet("number", None). Is there anything I'm missing?

@ancalita
Copy link
Member

ancalita commented Apr 29, 2021

I've managed to trigger the survey form immediately after the product_stock_form by modifying the action code:

class SurveyStart(Action):

    def name(self) -> Text:
        return "action_survey_start"

    async def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        if tracker.get_slot("survey_complete")==True:
            return[]
        else:
            dispatcher.utter_message(template="utter_ask_survey_form_number")
            return [FollowupAction("survey_form"), ActiveLoop("survey_form")]

However it identifies the entity number instead of feedback_rating 😒 and then it predicts utter_start_over - still investigating. Here's a snippet of debug log:

2021-04-29 12:20:08 DEBUG    rasa.core.processor  - Predicted next action 'survey_form' with confidence 1.00.
2021-04-29 12:20:08 DEBUG    rasa.core.actions.forms  - Validating user input 'UserUttered(text: 2, intent: inform, entities: 2 (Type: number, Role: None, Group: None), use_text_for_featurization: False)'.
2021-04-29 12:20:08 DEBUG    rasa.core.actions.forms  - Trying to extract requested slot 'rating' ...
2021-04-29 12:20:08 DEBUG    rasa.core.actions.forms  - Got mapping '{'entity': 'feedback_rating', 'type': 'from_entity'}'
2021-04-29 12:20:08 DEBUG    rasa.core.actions.forms  - Failed to extract requested slot 'rating'
2021-04-29 12:20:08 DEBUG    rasa.core.actions.forms  - Validating extracted slots: {}

@ancalita
Copy link
Member

Hi @desmarchris sorry for the multiple posts; I've managed to sort the issue you were having which leads me to think this was a usage error.

Here were the steps I took:

  • deduplicate number slot used in both forms & redefine the slot in survey_form as rating
  • rating slot is defined by entity number like so:
  survey_form:
    rating:
    - entity: number
      type: from_entity
    open_feedback:
    - type: from_text
  • add the code in bold in SurveyStart Action in the else branch:
        if tracker.get_slot("survey_complete")==True:
            return[]
        else:
            **dispatcher.utter_message(template="utter_ask_survey_form_number")**
            return [FollowupAction("survey_form"), **ActiveLoop("survey_form")**]

@wochinge do you agree with my conclusion?

@desmarchris
Copy link
Contributor Author

oh sweet! thanks for exploring @ancalita!

@ancalita
Copy link
Member

@desmarchris Ok, great! If all works on your end as well, I will close this ticket.
If you have any issues with this going forward, please re-open the issue and we'll look into it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/forms Issues focused around rasa forms effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

6 participants