Hello I am sorry about the troubles caused by the switching.
First of all you should check the box or the
blister to look for the generic name often in smaller print, if it does not say
Zolpidem anywhere then stop taking it, perhaps there's been a mix up at the pharmacy. I am saying this because Teva's zolpidem tablets usually have 74 printed instead of 95, but you have to check for yourself because I don't know how they do the numbering, might differ in different countries.
If it is Zolpidem then check also if it's the 10mg one as there are also 5mg ones.
If indeed it is Zolpidem 10mg than it is a question of manufacturer, not the pharmacy's fault.
Ambien is produced by Sanofi, the original manufacturer of Zolpidem in theory it should be as good a Zolpidem as it gets. Teva is a big manufacturer of generic drugs, meaning it didn't hold the original patent. In theory a generic drug should undergo strict control by authorities and be as good as the original one (and Teva is a respected manufacturer), but at times in my daily practice I notice that they are not 100% as effective. That might be your case. That's not the pharmacy's fault though as in theory they should be the same. So you should try to go back to Ambien, though it generally means you should pay more (depending on your insurance, country specific regulation etc), as generics usually are cheaper.
Hope that solves the issue. I wish you good health.