How to make an NPC be able to reactively parry?

So currently, I am trying to find out a way to make an NPC for my combat game that is able to see when a player attacks and then parry in reaction to that attack.

Right now, the system I have setup right now is, when a player is near an NPC, the NPC can log the actions that the player is currently doing, and then the NPC will react accordingly.

The problem is that there are ways for the player to cheese the NPC and then bait out the NPCs parry in unintended ways, such as quickly turning around right before the attack is committed to make the attack miss, thus causing the NPC to parry nothing.

Does anyone have any foolproof ways to make an actual reactive NPC Parry system or is this just not possible?

For cheesing, you can add a tag system to detect who attacked the npc and then the npc will parry, even though they aren’t close.