How can I get intent_ranking in custom channel?

Hi,

How can I return intent_ranking from my custom channel? Like below(Copied from http://localhost:5005/model/parse API response sample): { “entities”: [ { “start”: 0, “end”: 0, “value”: “string”, “entity”: “string”, “confidence”: 0 } ], “intent”: { “confidence”: 0.6323, “name”: “greet” }, “intent_ranking”: [ { “confidence”: 0.6323, “name”: “greet” } ], “text”: “Hello!” }

Currently, custom channels like facebook, twilio etc are all returning a list of messages. I’ve seen this: RASA NLU return list of intents in order of confidence . But it need agent object which I don’t know how to obtain from my custom channel either. Or do I need to do more customization other than custom channel?

Thanks.

Sorry, I realized I have asked a stupid question. I’m not familiar with python. Below are the solution which may be helpful for someone like me.

We can get agent by request.app.agent

and then current_state = request.app.agent.tracker_store.retrieve(sender_id).current_state() to get current state of the sender.