Question:
How can I access the confidence of previously detected entities before deciding if I want to fill a slot or not?
Following Use Case:
The user has a problem with a product. The chatbot starts a conversation and after some messages, we decide that we want to report an incident and start a form. Now we want to prefill our form with as much information as possible from the previous conversation. However, we only want automatically fill the slots if we are pretty sure that the item was correctly recognized, otherwise we ask the user to confirm.
Now I have a custom action to validate all form slots, what would be the best way to access the entity confidence for that slot? The tracker.latest_message only returns the values for the last message and tracker.latest_entity_values only returns the values without any confidence values.
I am thinking about something like that in my custom action:
async def validate_os_version(
self, slot_value: Any, dispatcher: CollectingDispatcher, tracker: Tracker, domain: DomainDict
) -> Dict[Text, Any]:
# Pseudo Code
#
# confidence = tracker.get_entity_confidence("os_version")
# if confidence < 0.6:
# dispatcher.utter_message("Hm, I am not sure about your OS Version. Is slot_value really correct?
# return {"os_version": None}
return {"os_version": slot_value }