How to Extract entity in custom action from tracker

How to get entity in custom action class?

Entity = tracker.latest_message[‘entity’].get(‘name’). it say not callable

It should be not name but value I guess. The names like in your training data

ent = tracker.latest_message['entities'].get['value']
object has no attribute 'get' 

it extracts the entity but I want only its value.

ent = tracker.latest_message['entities']

you can extract the value using this:

ent = tracker.latest_message['entities'][0]['value']

“ent” is an array with a dict inside, so the “[0]” is for get in the dict and you can obtain anything inside using the name of the key, in this case “value”.

6 Likes

Can you please share me the action.py import library and config.yml because I am get [] in my entity response