That all depends on how you implement your AI.
For eg you can make parent AI blueprint. Give it blueprint interface, and inside it implement function that returns some “love\hate” value.
Then you make 2 dimensional array (yes some coding around that unreal has only 1 dim arrays), and you put values for relations of faction vs faction. When this stuff is working you can place it inside pure function with 2 inputs for 2 factions and output for their relation.
With all that working and implemented in parent class blueprint, you cna inherit all other AI classes (factions).
Then when its time for AI to decide if target is enemy or not you just call that blueprint interface inside target.