I’m writing an action where tracker.get_slot returns the entity value. What I need is entity name corresponding to that entity value… please help
@akelad Please help
tracker.get_latest_entity_values
thanks.
Hey @akelad, thanks for your response. But i want the entity name to use it in my action and not the entity values.
One way to extract the entity type of the latest user input is by parsing the latest_message
variable of the DialogueStateTracker
class which contains the entire dump of the prediction from the NLU model
prediction = tracker.latest_message
entity_type = prediction['entities'][0]['entity']
Hello @akelad tracker.get_latest_entities_values
require parameter of entity type in new rasa version. But stil its not able to access entity values.
I my code it is showing error.
when i am trying to print entity values
enitiy values=>>>>>> The detail is as follows <generator object Tracker.get_latest_entity_values.<locals>.<genexpr> at 0x7fb3d77b9200>.
My actions.py code def run(self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
ent = tracker.get_latest_entity_values('str')
print("enitiy values=>>>>>>", ent)
domain.yml file entities:
- agriculture
- health
- education
- social welfare
nlu.md file
intent:test
entity_type = prediction[‘entities’][0][‘entity’] entity_value = prediction[‘entities’][0][‘value’]
works for me