Getting an error while using custom output payload

Hello Rasa community,

I’m using custom output payload as outlined here.

Here is a snippet of my domain.yml file which contains the utter_ask_howdoing:

utter_ask_howdoing:
    - custom:
        intent: ""
        message: "I'm doing great. Glad you asked!"
        response: []
        type: "message"

When sending “How are you” to the bot I get this response:

[
    {
        "recipient_id": "eee",
        "custom": {
            "intent": "",
            "message": "I'm doing great. Glad you asked!",
            "response": [],
            "type": "message"
        }
    }
]

That’s great because this is exactly what I want.

However, when checking the logs, I find this warning:

rasa_1           | 2019-06-20 08:10:06 ERROR    rasa.core.nlg.template  - Failed to fill utterance template 
'{'custom': {'intent': '', 'message': "I'm doing great. Glad you asked!", 'response': [], 'type': 'message'}}'. 
Tried to replace 'text' 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. 
rasa_1           | Traceback (most recent call last):
rasa_1           |   File "/usr/local/lib/python3.6/site-packages/rasa/core/nlg/template.py", line 114, in _fill_template_text
rasa_1           |     text = re.sub(r"{([^\n]+?)}", r"{0[\1]}", template["text"])
rasa_1           | KeyError: 'text'

I think it’s due to me using the ‘type’ property, is that right? How to fix it?

Yes, we actually ran into this issue a few weeks ago, I fixed it here. Updating to the latest rasa should fix it! :slight_smile:

Sorry for not noticing. Happy it’s fixed. Thank you, Ella! :slight_smile:

Not your fault at all! I forgot to add to the changelog :slight_smile:

Hi, I noticed that these custom output payload work fine now after the fix, but it ended up not replacing the intended variables with the available slots. utter_ask_something: - custom: name: “{name}” size: “{size}”

Hi @masterchief1s1k, you’re correct, at the moment, we only replace variables from within the text: field (and not any text fields nested within custom fields). There’s already an issue open for it that we will hopefully get around to soon. It would also be a great first contribution if you’re a python coder who would be willing to contribute!

1 Like

Good to know it’s an open issue! I will see whether i can come up with a quick fix for this and contribute what i might find.

That would be awesome! Here is the relevant issue: Fill slots in other parts of utterance templates than text · Issue #3763 · RasaHQ/rasa · GitHub

The logic in the code is found here: rasa/template.py at master · RasaHQ/rasa · GitHub

Hello, this issue was marked as solved a year ago, but it is not listed in any release yet, do you have an idea of when it’s going to come out?

1 Like