Assessing the Promise and Pitfalls of ChatGPT for Automated Code Generation