Optimizing AI-Assisted Code Generation