Recognizing change of subject

I am working on a bot which is supposed to, among others, provide data about employees in the company. For this I need to extract both first names and surnames of the employees and put them in their respective slots. This already works quite well.

However I need to be able to react to switching from a query about one employee, to a query about another. This works well if the entities are extracted correctly (the slots just get refilled) but if only the first name, or only the surname is extracted, the bot is wrongly thinking that all the required slots have been filled correctly.

As an example, suppose the conversation is as follows:

User: Give me the email to Adam Smith

Bot: Here’s the email to Adam Smith

User: What about the email for Zdzisław Brown?

Bot: Here’s the email to Adam Brown

The surname has been refilled, but first name was not. Is there some canonical way of proceeding in such situations? I realize that recognizing discontinuities in conversation is a very subtle and context-sensitive task.

The way I would like to solve it is via a custom component which i can include in the pipeline. But the problem is that I need access to the entities in the message before they get put into slots. Would putting my component after the CRF entity recognizer do the trick, or is it already too late, and the slots are already filled?

after giving the user Adam Smith’s email, you can reset the first and last name slots to None

But the problem is that I would like to keep the entities in the slots n case I get some follow up questions, i.e. know that the conversation is still about Adam Smith in such a case:

User: Give me the email to Adam Smith

Bot: Here’s the email to Adam Smith

User: And what about his phone number?

Bot: Here’s phone number to Adam Smith

User: I also need to know the name of his supervisor

Bot: Adam Smith’s supervisor is Joan Beckett

User: Ok, give me the email to Joan

Bot: I didn’t understand the surname, please enter it now.

User: Beckett

Bot: Here’s the email to Joan Beckett

I want to keep the slots filled, and reset them only after I’ve recognized that the subject of the query has change, i.e. the employees name has changed.

The main difficulty as I see it, is that I can only know that slots need a reset once I know that new entities have popped up.