A Sequential Optimal Learning Approach to Automated Prompt Engineering in Large Language Models