mxaviersmp / rasa-masterclass

Chatbot for recommendation of nearest Medic Care facility, built using Rasa 2
1 stars 2 forks source link

<rasa_sdk.interfaces.Tracker object at 0x7f2e063a7eb8> is not JSON serializable #1

Closed xkungfu closed 4 years ago

xkungfu commented 4 years ago

python 3.6.9 rasa 2.0.0rc3 rasa-sdk 2.0.0rc1

File "/rasa2rc3/env/lib/python3.6/site-packages/rasa_sdk/endpoint.py",  in webhook return response.json(result, status=200)
File "/rasa2rc3/env/lib/python3.6/site-packages/sanic/response.py", line 202, in json dumps(body, **kwargs),

TypeError: <rasa_sdk.interfaces.Tracker object at 0x7f2e063a7eb8> is not JSON serializable

the error caused from: action.py class FindFacilityTypes(Action) --> dispatcher.utter_message('utter_greet', buttons=buttons, tracker=tracker)

QUESTIONS: 1、what version of your rasa-sdk? 2、why dispatcher "tracker"? what useage of it? and what is it in fact? 3、how to resovle the error?

thanks!

mxaviersmp commented 4 years ago

Hi. I was running with python==3.7.9, rasa=2.0.0rc2 and rasa_sdk=2.0.0rc1. From what I understood, the tracker is used to keep the states of the conversation, and it was used as in dispatcher.utter_button_template on v1, but this function is deprecated for v2, because dispatcher.utter_message can also send buttons. I didn't encounter this error before, but now I got the same error, using the same versions as you, so I think the tracker param is not needed anymore. Removing it fixed the error for me.

xkungfu commented 4 years ago

got it! thank you very much!