question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bot utterance fails: _utter_responses sets text to None by updating dict values

See original GitHub issue

Rasa version: 1.5.0

Python version: 3.6.8

Operating system: Windows 10

Issue:

The rasa.core.processor ends processing with:

BotUttered(text: None, data: {"elements": [], "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {"caller_number_permission": null, "fullname": null, "permission": null, "phonenumber": null, "purpose": null, "requested_slot": null})

although a template has been generated by an external action server. After investigating the

    @staticmethod
    async def _utter_responses(

method of rasa.core.actions.action.py I observed that if there is a template in the response, the method iterates over, the draft is built correctly. A few lines later, the draft dictionary is updated on the formerly used response which means that the 'text' key of draft, that has previously been filled with the utterance, is now overwritten with the None value of the response.

As far as I have seen, we could possibly change the implementation such that we say:

response.update(draft)
bot_messages.append(create_bot_utterance(response))

since in draft lies the result of the response-processing, separated from the original. I tested it and it worked properly but maybe there are some consequences I might not see atm.

Regards Julian

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
erohmensingcommented, Nov 27, 2019

Haha, no problem. Thanks so much for reporting, I’m sure we got this stuff fixed a lot faster than if you hadn’t!

1reaction
JulianGerhard21commented, Nov 27, 2019

Hi @erohmensing,

you were a second quicker than me - already checked - it was solved! 😃

Thanks a lot to you and the team!

Regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why while updating a dictionary getting None? - Stack Overflow
I am basically merging two dictionaries by using update method. The problem is when I merge in python shell it works but not...
Read more >
Python Dictionary update() - Programiz
The update() method updates the dictionary with the elements from another dictionary object or from an iterable of key/value pairs.
Read more >
Python Dictionary update() method - GeeksforGeeks
Returns: It doesn't return any value but updates the Dictionary with elements from a dictionary object or an iterable object of key/value pairs....
Read more >
Add an item only when the key does not exist in dict in Python ...
If a non-existent key is specified, a new item is added. If a key that already exists is specified, the existing value is...
Read more >
Python Dictionary (Dict) Tutorial - AskPython
Python Dictionary is a set of key-value pairs. A dictionary is an object of dict class. We can iterate using Dictionary keys and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found