pythonrasa-nlurasa-corerasarasa-x

Failed to fill utterance template - Rasa Chatbot


First I ran the command rasa run actions and then I ran rasa train and then rasa x. I get an error.

Failed to fill utterance template 'Play the game [ ] {mario_link}'. Tried to replace 'mario_link' but could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the template. Return template without filling the template.

domain.yml file

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- mario
responses:
  utter_game_mario:
  - text: Play the game [ ] {mario_link}
actions:
- action_mario

actions.py file

from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher


class ActionHelloWorld(Action):
    def name(self) -> Text:
        return "action_mario"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
            # dispatcher.utter_message(text="Hello World!")

            link = "https://supermarioemulator.com/supermario.php"

            dispatcher.utter_template("utter_game_mario", tracker, link=link)
            return []

nlu.md file

## intent:mario
- i want to play mario
- start mario
- play mario

endpoints.yml file

action_endpoint:
  url: "http://localhost:5055/webhook"

stories.md file

## game
* mario
    - action_mario

I have used these references and did not work for me:

  • Re-installed latest version of Rasa: https://forum.rasa.com/t/getting-an-error-while-using-custom-output-payload/11802

  • No idea what the solution is here: https://github.com/RasaHQ/rasa/issues/4550

  • This did not make any sense: https://github.com/RasaHQ/rasa/pull/4079/files/6c14ab262e915369915876425670843ab348201e

  • Please help. Why am I getting this error?


    Solution

  • Make the following changes and it should work

    in domain.yml:

    - text: Play the game {mario_link}
    

    in actions.py

    add this line

    tracker.get_slot('mario_link')
    

    and change this one

    dispatcher.utter_template("utter_game_mario", tracker, mario_link=link)
    

    But what I would personally do is not using an utter_response at all in here and just use the action and print the answer using dispatcher.utter_message()