const Anthropic = require('@anthropic-ai/sdk'); const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, }); const generateGuide = async (guideData) => { try { const prompt = buildPrompt(guideData); const response = await anthropic.messages.create({ model: 'claude-3-sonnet-20240229', max_tokens: 4000, temperature: 0.7, messages: [{ role: 'user', content: prompt }] }); const generatedContent = response.content[0].text; return formatAsHTML(generatedContent, guideData); } catch (error) { console.error('Claude API error:', error); throw new Error('Failed to generate guide content'); } }; const buildPrompt = (data) => { return `You are an expert acting coach trained by Corey Ralston. Create a comprehensive, personalized audition preparation guide. CHARACTER INFO: - Character Name: ${data.characterName} - Production: ${data.productionTitle} - Production Type: ${data.productionType} - Role Size: ${data.roleSize} - Genre: ${data.genre} ${data.storyline ? `- Storyline: ${data.storyline}` : ''} ${data.characterBreakdown ? `- Character Breakdown: ${data.characterBreakdown}` : ''} ${data.callbackNotes ? `- Callback Notes: ${data.callbackNotes}` : ''} ${data.focusArea ? `- Focus Area: ${data.focusArea}` : ''} SCENE TEXT: ${data.sceneText} Create a comprehensive audition guide with these sections: 1. Project Overview 2. Character Breakdown 3. Uta Hagen's 9 Questions 4. Scene Action & Physicality 5. Subtext & Emotional Depth 6. Character POV & Personalization 7. Bold Acting Choices 8. Moment Before & Button 9. Rehearsal & Experimentation 10. Action Plan Checklist Make it personal, specific, and motivational. Focus on helping the actor book the role.`; }; const formatAsHTML = (content, guideData) => { return `