Inform intent is not correctly recognized

Hello,

I am building a helpdesk chatbot, where the user can ask about his/her current course progress. As a result, the chatbot asks the user which course he/she wants to know the progress of. After informing the chatbot, the chatbot should tell the user the progress.

However, this does not work as intended. I guess the big problem is, that the courses are similar to many FAQs. E.g. a course name is “AI for beginners” and the FAQ is “What is AI”? So whenever the user informs the chatbot e.g. this course name, he receives the answer of what AI is.

My story for this use case is the following:

- story: Get achievements and courses available
  steps:
  - intent: get_achievements
  - action: action_get_courses
  - slot_was_set:
    - courses_available: true
  - action: utter_ask_which_course
  - intent: inform
  - slot_was_set:
    - current_course_title: "Data2Teach - Wie Daten Schule und Schulen Daten machen"
  - action: utter_submit
  - action: utter_starting_search_with_parameters
  - checkpoint: get_achievements

The slot current course title is defined as follows:

current_course_title:
    type: text
    influence_conversation: false
    mappings:
    - type: from_text
      conditions:
      - active_loop: course_form
        requested_slot: current_course_title

inform intent:

  - intent: inform
    examples: |
      - Für den Kurs [Schule macht Daten]{"entity": "Course"}
      - Für [Schule macht Daten]{"entity": "Course"}
      - Der Kurs [Schule macht Daten]{"entity": "Course"}
      - Der Kurs ist [Schule macht Daten]{"entity": "Course"}
      - [Schule macht Daten]{"entity": "Course"}

I defined my FAQs based on this documentation.

I am happy to provide more information if requested. I’m pretty desperate because I’ve been sitting on this information problem for a really long time and don’t know what to do.

Thanks in advance for your time and help!

Rasa Version      :         3.0.6
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.4
Rasa X Version    :         None
Python Version    :         3.7.2
Operating System  :         Darwin-21.5.0-x86_64-i386-64bit

I would convert this to a form. inform intents are used within the context of a form.

@stephens Thanks for your reply.

Would this be the correct form for this context?

- story: Get achievements and courses available
  steps:
  - intent: get_achievements
  - action: action_get_courses_buttons
  - slot_was_set:
    - courses_available: true
  - action: utter_ask_which_course
  - action: course_form
  - active_loop: course_form
  - intent: inform
  - active_loop: null
  - slot_was_set:
    - current_course_title: "Data2Teach - Wie Daten Schule und Schulen Daten machen"
  - action: utter_submit
  - action: utter_starting_search_with_parameters
  - checkpoint: get_achievements

Something like this:

- story: Get achievements and courses available
  steps:
  - intent: get_achievements
  - action: course_form
  - active_loop: course_form

The form then requests the name of the course and associated parameters.

@stephens

I have the following story with form now:

- story: Get achievements and courses available
  steps:
  - intent: get_achievements
  - action: action_get_courses_buttons
  - slot_was_set:
    - courses_available: true
  - action: course_form
  - active_loop: course_form
  - action: utter_ask_which_course
  - intent: inform
  - action: validate_course_form
  - slot_was_set:
    - current_course_title: "Data2Teach - Wie Daten Schule und Schulen Daten machen"
  - active_loop: null
  - action: utter_submit
  - action: utter_starting_search_with_parameters
  - checkpoint: get_achievements

I defined the form in my domain file as follows:

forms:
  course_form:
    ignored_intents:
    - faq
    - greet
    - goodbye
    - thank
    - deny
    - affirm
    required_slots:
      - current_course_title

I have the inform-intent: (with just a list of some of the possible courses)

  - intent: inform
    examples: |
      - Erklärbares Maschinelles Lernen für Ingenieurwissenschaften
      - Launchpad to Fundamental Questions on AI
      - Schule macht KI
      - Wegweisende Anwendungen fürs Web
      - Wie das Web technisch funktioniert
      - Programmieregen fürs Web
      - Mensch-Maschine-Interaktion
      - Robot Learning
      - Den Daten auf der Spur - Der Process Mining Podcast
      - Daten- und Algorithmenethik
      - AutoML - Automated Machine Learning
      - Einführung in die KI
      - Erklärbares Maschinelles Lernen für Ingenieurwissenschaften
      - Schule macht Daten
      - Dr. med. KI
      - Team Peer Assessments

I even removed the faq rules for now but it’s still not working. Now the user selects a course with e.g.:

{
  "sender": "theresa",
  "message": "Von der Datenanalyse zur Datengeschichte – Datenanalyseergebnisse adressatengerecht kommunizieren"
}

and then as a result I just get [].

So I added a new action to valide the course form (which does not do anything different):

class ValidateCourseForm(FormValidationAction):
	def name(self) -> Text:
		return "validate_course_form"

	async def extract_current_course(
									self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
					) -> Dict[Text, Any]:
		text_of_last_user_message = tracker.latest_message.get("text")
		print(text_of_last_user_message)
		return {"current_course_title": text_of_last_user_message}

Is there anything you notice what I am doing wrong?

You need to follow the form examples. You should look at one of the example bots like the helpdesk-assistant.

You need to replace the entire Get achievements and courses available story with the example I provided based upon the docs. Do the rest of teh dialog with the form (not stories).

@stephens Thank you for pointing me in this direction, this part works now very well!

However, I am still unsure how to continue. I know have the following story and rules:

- story: Get achievements, no more info
  steps:
  - intent: get_achievements
  - action: action_get_courses_buttons
  - slot_was_set:
    - courses_available: True
  - action: utter_ask_which_course
  - action: course_form
  - active_loop: course_form
  - intent: inform
  - action: utter_submit
  - action: utter_starting_search_with_parameters
  - active_loop: null
  - action: action_get_achievements
  - slot_was_set:
    - current_course_achieved: False
  - action: utter_anything_else
  - intent: deny
  - action: utter_have_a_nice_day


- story: Get achievements, more info
  steps:
  - intent: get_achievements
  - action: action_get_courses_buttons
  - slot_was_set:
    - courses_available: True
  - action: utter_ask_which_course
  - action: course_form
  - active_loop: course_form
  - intent: inform
  - action: utter_submit
  - action: utter_starting_search_with_parameters
  - active_loop: null
  - action: action_get_achievements
  - slot_was_set:
    - current_course_achieved: False
  - action: utter_anything_else
  - intent: affirm
  - action: utter_more_info
  - rule: start course form courses available
    steps:
    - intent: get_achievements
    - action: action_get_courses_buttons
    - slot_was_set:
      - courses_available: True
    - action: utter_ask_which_course
    - action: course_form
    - active_loop: course_form

  - rule: submit course form
    condition:
      - active_loop: course_form
    steps:
    - action: course_form
    - active_loop: null
    - action: action_get_achievements
    - slot_was_set:
      - current_course_achieved: null

  - rule: course achieved, more info
    condition:
    - slot_was_set:
      - current_course_achieved: False
    steps:
    - action: utter_anything_else
    - intent: affirm
    - action: utter_more_info

  - rule: course achieved, no more info
    condition:
    - slot_was_set:
      - current_course_achieved: False
    steps:
    - action: utter_anything_else
    - intent: deny
    - action: utter_have_a_nice_day

This works perfectly fine to the point “- action: action_get_achievements” then nothing more happens. I could not find a similar case described in the repository or the documentation provided. Before I had these cases handled with checkpoints, which is now not possible because rules do not have checkpoints. But how do I go on from here with the form and rules / story if there are many different paths on the way? Do I write really long rules / stories then? Isn’t there a more beautiful way?