>>28639355They improved the AI in X/Y. I had a few instances of trainers switching out mons, mainly if they had a Flash Fire/Sap Sipper in the back and they have seen a move of the same type already, or if they are locked into a move and you bring a pokemon immune to it.
I wish they took it farther though, if you have a Fire type mon out, and they have grass out and water in the back, they should by all means switch out.