Architecting AI Systems to Prevent Hallucinations: A Comprehensive Guide