Rasa custom forms not working

Hello,

I am trying to create a custom FormAction. The goal is to ask the user several questions and for each questions the goal is to save the whole user answer in a slot. All the inputs should then be send to a document creation service using api.

The problem is that my FormAction is not working. This is how I tried it:

class It_Innovation_Form(FormAction):

def name(self):
    return "it_innovation_form"

@staticmethod
def required_slots(tracker):

    return ["idea_name", "short_description", "solved_problem", "added_value", "advantage_to_existing_solutions", 
            "ask_technologies", "ask_awareness_technologies", "difficulty_it_innovation", "situation_withoutinnovation"]
   

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 {
        "idea_name": [
            self.tracker.latest_message.text,
        ],
        "short_description": [
            self.tracker.latest_message.text,
        ],
        "solved_problem": [
            self.tracker.latest_message.text,
        ],
        "added_value": [
            self.tracker.latest_message.text,
        ],
        "advantage_to_existing_solutions": [
            self.tracker.latest_message.text,
        ],
        "ask_technologies": [
            self.tracker.latest_message.text,
        ],
        "ask_awareness_technologies": [
            self.tracker.latest_message.text,
        ],
        "difficulty_it_innovation": [
            self.tracker.latest_message.text,
        ],
        "situation_withoutinnovation": [
            self.tracker.latest_message.text,
        ],
    }

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

    dispatcher.utter_message("Thanks for your inputs, you have now described your innovation idea!")
    return []

Blockquote

I get the following error message: AttributeError: ‘It_Innovation_Form’ object has no attribute ‘tracker’

If any of you have tips on how to solve my problem that would be great.

Which Rasa Open Source version are you using? Things changed a lot with Rasa Open Source 2.0 which - in your case - make any Python code unnecessary: Forms

First thanks for your answer and your help. I am using rasa open source 2.0. Maybe I misunderstood it, but I want to save the whole text the user types in into my slots.

To achieve this I need to make a Custom Slot Mapping and I need to do this with python code. Is this right?

I tried it by using only Forms without any python code:

slots:
idea_name:
type: text
added_value:
type: text

forms:
it_innovation_form:
required_slots:
idea_name:
- type: from_text
added_value:
- type: from_text

responses:
utter_ask_it_innovation_form_idea_name:

  • text: Give the idea a name

utter_ask_short_description:

  • text: Please describe your whole idea briefly in 2-3 sentences

actions:

  • it_innovation_form

But I get the error message: ERROR rasa_sdk.endpoint - No registered action found for name ‘it_innovation_form’.

rasa.shared.exceptions.RasaException: Failed to execute custom action.

I don`t know why it is not finding the action “it_innovation_form” as I mentioned it under actions.