I think they are smart but not smart enough. I have seen, occasionally, AI switch out for a better pokemon, but this was usually after 4 - 5 turns anyway.
Bottom line for me is this, if you are 8 or younger they might be tough. If not, they suck.
I don't recall having an trouble with battles when I was 8. The toughest would have been trainers like Whitney or something. The AI is just really easy, you don't even need to use type advantages. But that's the way it's always been and I'm sure that's the way the majority of Pokemon fans want it.
It would be neat if they gave a Pokemon game a 'Master Quest' treatment, I'd like to give that a try.